diff --git a/CMakeLists.txt b/CMakeLists.txt index e4b4cd451d..ae9921dde2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ endif(ANDROID) option(ALLEGRO_SDL "Build using the SDL backend (experimental)" OFF) option(WANT_STATIC_RUNTIME "Whether or not to link the C and C++ runtimes statically (currently only implemented on Windows)" OFF) -set(ALLEGRO_VERSION 5.2.7) +set(ALLEGRO_VERSION 5.2.8) string(REGEX MATCH "^[0-9]+[.][0-9]+" ALLEGRO_SOVERSION ${ALLEGRO_VERSION}) string(REPLACE "." "" ALLEGRO_DLL_SHORTVER ${ALLEGRO_SOVERSION}) @@ -204,6 +204,12 @@ option(WANT_EXAMPLES "Build example programs" on) option(WANT_POPUP_EXAMPLES "Use popups instead of printf for fatal errors" on) option(WANT_TESTS "Build test programs" on) +option(WANT_WAIT_EVENT_SLEEP "Use sleep instead of threads in al_wait_for_event (only useful for emscripten without web workers)" off) + +if(WANT_WAIT_EVENT_SLEEP) + set(ALLEGRO_WAIT_EVENT_SLEEP 1) +endif() + #-----------------------------------------------------------------------------# # # Set up compilers @@ -418,6 +424,10 @@ if(COMPILER_GCC_OR_CLANG) endif() if(COMPILER_MSVC) set(WFLAGS "/W3 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE") + if(CMAKE_C_COMPILER_ID MATCHES "Clang") + # Clang is more strict than MSVC's compiler here. + set(WFLAGS "${WFLAGS} -Wno-c++11-narrowing") + endif() endif(COMPILER_MSVC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WFLAGS} ${WFLAGS_C_ONLY}") @@ -903,8 +913,10 @@ if(MACOSX) list(APPEND LIBRARY_SOURCES ${ALLEGRO_SRC_MACOSX_FILES}) find_library(APPKIT_LIBRARY AppKit) find_library(IOKIT_LIBRARY IOKit) + find_library(COREVIDEO_LIBRARY CoreVideo) list(APPEND PLATFORM_LIBS ${APPKIT_LIBRARY}) list(APPEND PLATFORM_LIBS ${IOKIT_LIBRARY}) + list(APPEND PLATFORM_LIBS ${COREVIDEO_LIBRARY}) endif(MACOSX) if(IPHONE) @@ -1075,6 +1087,7 @@ if(NOT MSVC80 AND WANT_DEMO) # XXX disabled because it breaks MSVC's intellisens add_subdirectory(demos/cosmic_protector) add_subdirectory(demos/speed) add_subdirectory(demos/skater) + add_subdirectory(demos/shooter) endif(NOT MSVC80 AND WANT_DEMO) #-----------------------------------------------------------------------------# diff --git a/README_sdl.txt b/README_sdl.txt new file mode 100644 index 0000000000..2cd2beb3cc --- /dev/null +++ b/README_sdl.txt @@ -0,0 +1,122 @@ +SDL +=== + +This is an experimental port which uses SDL2 to create the Allegro +window and OpenGL context. + + +Dependencies +------------ + +SDL2 is required. + + +Building +-------- + +Pass -D ALLEGRO_SDL=on to cmake to enable building for SDL2. + + +Limitations +----------- + +SDL2 requires calling SDL_PumpEvents() from the main thread regularly to +generate events. Currently Allegro5 makes those calls from the timer +subsystem - so as long as you have any timers running things will work +fine. If your Allegro 5 program uses no timers it may get stuck because +no SDL2 events can be received. + + +Emscripten +---------- + +One reason the SDL2 port is useful is that it allows running Allegro on +platforms not supported directly by Allegro, such as Emscripten. This is +even more experimental but here are some example steps that will compile +most of the examples for running in a web browser: + +1. Make sure to set up the emscripten environment by running the + +emsdk_env.sh + +or equivalent as provided by emscripten. + +2. Create a build folder. + +mkdir build_emscripten +cd build_emscripten + +3. The "--preload-file data" option below includes a folder named "data" +with each binary, so we make sure each example and demo has such a +folder: + +mkdir -p demos/speed/data +demos/speed/data/nothing.txt + +4. Configure CMake, using emcmake. + +USE_FLAGS=( + -s USE_FREETYPE=1 + -s USE_VORBIS=1 + -s USE_OGG=1 + -s USE_LIBJPEG=1 + -s USE_SDL=2 + -s USE_LIBPNG=1 + -s FULL_ES2=1 + -s ASYNCIFY + -s TOTAL_MEMORY=2147418112 + -O3 + ) + +emcmake cmake {path-to-allegro-source-folder} + -D CMAKE_BUILD_TYPE=Release + -D ALLEGRO_SDL=ON + -D SHARED=OFF + -D WANT_MONOLITH=ON + -D WANT_ALLOW_SSE=OFF + -D WANT_DOCS=OFF + -D WANT_TESTS=OFF + -D WANT_OPENAL=OFF + -D ALLEGRO_WAIT_EVENT_SLEEP=ON + # not sure why these are not found automatically with emcmake, so + # we use a hack - we manually specify the cache path, so cmake + # will fail on first run in the compile test but populate the cache + # (from the -s options) and on second run it all works + -D SDL2_INCLUDE_DIR=$EM_CACHE/sysroot/include + -D PNG_PNG_INCLUDE_DIR=$EM_CACHE/sysroot/include + -D PNG_LIBRARY=$EM_CACHE/sysroot/lib/wasm32-emscripten/libpng.a + -D JPEG_INCLUDE_DIR=$EM_CACHE/sysroot/include + -D JPEG_LIBRARY=$EM_CACHE/sysroot/lib/wasm32-emscripten/libjpeg.a + -D FREETYPE_INCLUDE_DIRS=$EM_CACHE/sysroot/include + -D FREETYPE_LIBRARY=$EM_CACHE/sysroot/lib/wasm32-emscripten/libfreetype.a + -D VORBIS_INCLUDE_DIR=$EM_CACHE/sysroot/include/vorbis + -D VORBIS_LIBRARY=$EM_CACHE/sysroot/lib/wasm32-emscripten/libvorbis.a + -D VORBISFILE_LIBRARY=$EM_CACHE/sysroot/lib/wasm32-emscripten/libvorbis.a + -D OGG_INCLUDE_DIR=$EM_CACHE/sysroot/include + -D OGG_LIBRARY=$EM_CACHE/sysroot/lib/wasm32-emscripten/libogg.a + -D CMAKE_C_FLAGS="${USE_FLAGS}" + -D CMAKE_CXX_FLAGS="${USE_FLAGS}" + -D CMAKE_EXE_LINKER_FLAGS="${USE_FLAGS} --preload-file data" + -D CMAKE_EXECUTABLE_SUFFIX_CXX=".html" + +Emscripten will take care of downloading the dependencies mentioned above via +its ports system. + +To compile your own game adjust as necessary. You can use the +lib/liballegro_monolith-static.a library. + +5. Compile the library and examples. + +make + +Since that can take awhile (a lot slower than regular compilation speed), you +may want to compile individual examples, e.g. + +make ex_draw_bitmap + +6. To run the examples, navigate to the examples folder. At this point it is +easiest to start a local webserver, and then navigate to the examples using a +web browser. E.g. you could use the Python's web server module which prints out +a URL you can open: + +python3 -m http.server diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000000..f6fdd6f908 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,22 @@ +# Security Policy + +## Report a security issue + +The Allegro project team welcomes security reports and is committed to +providing prompt attention to security issues. Security issues should be +reported privately by sending an email to +. + +## Version support + +| Version | Supported | +| ------- | ------------------ | +| >= 5.2.x| Yes | +| < 5.2 | No | + +## Security advisories + +Remediation of security vulnerabilities is prioritized by the project team +based on the overall impact. The project team is committed to transparency in +the disclosure process. The Allegro team announces security issues Allegro +Release notes, as well as the Allegro website on a best-effort basis. diff --git a/addons/acodec/CMakeLists.txt b/addons/acodec/CMakeLists.txt index d8f5a8219d..ce5df080ad 100644 --- a/addons/acodec/CMakeLists.txt +++ b/addons/acodec/CMakeLists.txt @@ -225,12 +225,12 @@ elseif(WANT_VORBIS) find_package(Vorbis) if(VORBIS_FOUND) set(CMAKE_REQUIRED_INCLUDES ${OGG_INCLUDE_DIR} ${VORBIS_INCLUDE_DIR}) - if(COMPILER_GCC_OR_CLANG) + if(MSVC) + set(CMAKE_REQUIRED_LIBRARIES "${VORBIS_LIBRARIES}") + else() # libm is required when linking statically. set(CMAKE_REQUIRED_LIBRARIES "${VORBIS_LIBRARIES};m") - else() - set(CMAKE_REQUIRED_LIBRARIES "${VORBIS_LIBRARIES}") - endif(COMPILER_GCC_OR_CLANG) + endif() run_c_compile_test(" #include int main(void) @@ -284,12 +284,12 @@ if(WANT_OPUS) find_package(Opus) if(OPUS_FOUND) set(CMAKE_REQUIRED_INCLUDES ${OGG_INCLUDE_DIR} ${OPUS_INCLUDE_DIR}) - if(COMPILER_GCC_OR_CLANG) + if(MSVC) + set(CMAKE_REQUIRED_LIBRARIES "${OPUS_LIBRARIES}") + else() # libm is required when linking statically. set(CMAKE_REQUIRED_LIBRARIES "${OPUS_LIBRARIES};m") - else() - set(CMAKE_REQUIRED_LIBRARIES "${OPUS_LIBRARIES}") - endif(COMPILER_GCC_OR_CLANG) + endif() run_c_compile_test(" #include int main(void) diff --git a/addons/audio/sdl_audio.c b/addons/audio/sdl_audio.c index 719a316450..ef9fc058f2 100644 --- a/addons/audio/sdl_audio.c +++ b/addons/audio/sdl_audio.c @@ -54,6 +54,15 @@ static SDL_AudioFormat allegro_format_to_sdl(ALLEGRO_AUDIO_DEPTH d) return AUDIO_F32; } +static ALLEGRO_AUDIO_DEPTH sdl_format_to_allegro(SDL_AudioFormat d) +{ + if (d == AUDIO_S8) return ALLEGRO_AUDIO_DEPTH_INT8; + if (d == AUDIO_U8) return ALLEGRO_AUDIO_DEPTH_UINT8; + if (d == AUDIO_S16) return ALLEGRO_AUDIO_DEPTH_INT16; + if (d == AUDIO_U16) return ALLEGRO_AUDIO_DEPTH_UINT16; + return ALLEGRO_AUDIO_DEPTH_FLOAT32; +} + static int sdl_allocate_voice(ALLEGRO_VOICE *voice) { SDL_VOICE *sv = al_malloc(sizeof *sv); @@ -73,6 +82,8 @@ static int sdl_allocate_voice(ALLEGRO_VOICE *voice) voice->extra = sv; sv->voice = voice; + // we allow format change above so need to update here + voice->depth = sdl_format_to_allegro(sv->spec.format); return 0; } diff --git a/addons/primitives/high_primitives.c b/addons/primitives/high_primitives.c index 91742a4b13..c3a94f30e8 100644 --- a/addons/primitives/high_primitives.c +++ b/addons/primitives/high_primitives.c @@ -520,7 +520,7 @@ void al_draw_pieslice(float cx, float cy, float r, float start_theta, } if (thickness <= 0) { - num_segments = fabs(delta_theta / (2 * ALLEGRO_PI) * ALLEGRO_PRIM_QUALITY * scale * sqrtf(r)); + num_segments = fabs(delta_theta / (2 * ALLEGRO_PI) * ALLEGRO_PRIM_QUALITY * sqrtf(scale * r)); if (num_segments < 2) num_segments = 2; @@ -566,7 +566,7 @@ void al_draw_pieslice(float cx, float cy, float r, float start_theta, vertex_cache[0].x = cx + (r - thickness / 2) * cosf(central_start_angle); vertex_cache[0].y = cy + (r - thickness / 2) * sinf(central_start_angle); - num_segments = (inner_side_angle + outer_side_angle) / (2 * ALLEGRO_PI) * ALLEGRO_PRIM_QUALITY * scale * sqrtf(r + ht); + num_segments = (inner_side_angle + outer_side_angle) / (2 * ALLEGRO_PI) * ALLEGRO_PRIM_QUALITY * sqrtf(scale * (r + ht)); if (num_segments < 2) num_segments = 2; @@ -620,7 +620,7 @@ void al_draw_pieslice(float cx, float cy, float r, float start_theta, /* Apex: 2 vertices if the apex is blunt) */ int extra_vtx = blunt_tip ? 2 : 1; - num_segments = (2 * outer_side_angle) / (2 * ALLEGRO_PI) * ALLEGRO_PRIM_QUALITY * scale * sqrtf(r + ht); + num_segments = (2 * outer_side_angle) / (2 * ALLEGRO_PI) * ALLEGRO_PRIM_QUALITY * sqrtf(scale * (r + ht)); if (num_segments < 2) num_segments = 2; @@ -669,7 +669,7 @@ void al_draw_filled_pieslice(float cx, float cy, float r, float start_theta, ASSERT(r >= 0); - num_segments = fabs(delta_theta / (2 * ALLEGRO_PI) * ALLEGRO_PRIM_QUALITY * scale * sqrtf(r)); + num_segments = fabs(delta_theta / (2 * ALLEGRO_PI) * ALLEGRO_PRIM_QUALITY * sqrtf(scale * r)); if (num_segments < 2) num_segments = 2; @@ -701,7 +701,7 @@ void al_draw_ellipse(float cx, float cy, float rx, float ry, ASSERT(ry >= 0); if (thickness > 0) { - int num_segments = ALLEGRO_PRIM_QUALITY * scale * sqrtf((rx + ry) / 2.0f); + int num_segments = ALLEGRO_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f); int ii; /* In case rx and ry are both 0. */ @@ -720,7 +720,7 @@ void al_draw_ellipse(float cx, float cy, float rx, float ry, al_draw_prim(vertex_cache, 0, 0, 0, 2 * num_segments, ALLEGRO_PRIM_TRIANGLE_STRIP); } else { - int num_segments = ALLEGRO_PRIM_QUALITY * scale * sqrtf((rx + ry) / 2.0f); + int num_segments = ALLEGRO_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f); int ii; /* In case rx and ry are both 0. */ @@ -753,7 +753,7 @@ void al_draw_filled_ellipse(float cx, float cy, float rx, float ry, ASSERT(rx >= 0); ASSERT(ry >= 0); - num_segments = ALLEGRO_PRIM_QUALITY * scale * sqrtf((rx + ry) / 2.0f); + num_segments = ALLEGRO_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f); /* In case rx and ry are both close to 0. If al_calculate_arc is passed * 0 or 1 it will assert. @@ -801,7 +801,7 @@ void al_draw_elliptical_arc(float cx, float cy, float rx, float ry, float start_ ASSERT(rx >= 0 && ry >= 0); if (thickness > 0) { - int num_segments = fabs(delta_theta / (2 * ALLEGRO_PI) * ALLEGRO_PRIM_QUALITY * scale * sqrtf((rx + ry) / 2.0f)); + int num_segments = fabs(delta_theta / (2 * ALLEGRO_PI) * ALLEGRO_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f)); int ii; if (num_segments < 2) @@ -820,7 +820,7 @@ void al_draw_elliptical_arc(float cx, float cy, float rx, float ry, float start_ al_draw_prim(vertex_cache, 0, 0, 0, 2 * num_segments, ALLEGRO_PRIM_TRIANGLE_STRIP); } else { - int num_segments = fabs(delta_theta / (2 * ALLEGRO_PI) * ALLEGRO_PRIM_QUALITY * scale * sqrtf((rx + ry) / 2.0f)); + int num_segments = fabs(delta_theta / (2 * ALLEGRO_PI) * ALLEGRO_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f)); int ii; if (num_segments < 2) @@ -861,7 +861,7 @@ void al_draw_rounded_rectangle(float x1, float y1, float x2, float y2, ASSERT(ry >= 0); if (thickness > 0) { - int num_segments = ALLEGRO_PRIM_QUALITY * scale * sqrtf((rx + ry) / 2.0f) / 4; + int num_segments = ALLEGRO_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f) / 4; int ii; /* In case rx and ry are both 0. */ @@ -908,7 +908,7 @@ void al_draw_rounded_rectangle(float x1, float y1, float x2, float y2, al_draw_prim(vertex_cache, 0, 0, 0, 8 * num_segments + 2, ALLEGRO_PRIM_TRIANGLE_STRIP); } else { - int num_segments = ALLEGRO_PRIM_QUALITY * scale * sqrtf((rx + ry) / 2.0f) / 4; + int num_segments = ALLEGRO_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f) / 4; int ii; /* In case rx and ry are both 0. */ @@ -955,7 +955,7 @@ void al_draw_filled_rounded_rectangle(float x1, float y1, float x2, float y2, LOCAL_VERTEX_CACHE; int ii; float scale = get_scale(); - int num_segments = ALLEGRO_PRIM_QUALITY * scale * sqrtf((rx + ry) / 2.0f) / 4; + int num_segments = ALLEGRO_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f) / 4; ASSERT(rx >= 0); ASSERT(ry >= 0); diff --git a/allegro5.cfg b/allegro5.cfg index 99f4c8378d..071ad3a00b 100644 --- a/allegro5.cfg +++ b/allegro5.cfg @@ -32,6 +32,13 @@ config_selection=new # card. prim_d3d_legacy_detection=default +# For compatibility reasons, video bitmaps smaller than this size are +# backed by textures with this size. This is often no longer necessary +# on more modern systems, and should be set to < 16 if you're creating +# bitmaps smaller than this size. Note that on Android, this is ignored +# if smaller than 32. +min_bitmap_size=16 + [audio] # Driver can be 'default', 'openal', 'alsa', 'oss', 'pulseaudio' or 'directsound' diff --git a/demos/shooter/CMakeLists.txt b/demos/shooter/CMakeLists.txt new file mode 100644 index 0000000000..8c6e1a22b6 --- /dev/null +++ b/demos/shooter/CMakeLists.txt @@ -0,0 +1,126 @@ +if(SUPPORT_FONT AND SUPPORT_TTF AND SUPPORT_AUDIO AND SUPPORT_ACODEC) +else() + message(STATUS "Not building scooter demo") + return() +endif() + +include_directories( + ${PROJECT_SOURCE_DIR}/addons/acodec + ${PROJECT_SOURCE_DIR}/addons/audio + ${PROJECT_SOURCE_DIR}/addons/font + ${PROJECT_SOURCE_DIR}/addons/image + ${PROJECT_SOURCE_DIR}/addons/main + ${PROJECT_SOURCE_DIR}/addons/primitives + ${PROJECT_SOURCE_DIR}/addons/ttf + ) + +set(DEMO_SRCS + aster.c + bullet.c + data.c + demo.c + expl.c + game.c + star.c + title.c + ../speed/a4_aux.c + ) + +file(COPY ${PROJECT_SOURCE_DIR}/examples/data/DejaVuSans.ttf + DESTINATION ${CMAKE_BINARY_DIR}/demos/shooter/data) +file(COPY ${PROJECT_SOURCE_DIR}/demos/skater/data/menu/intro_music.ogg + DESTINATION ${CMAKE_BINARY_DIR}/demos/shooter/data) +file(COPY ${PROJECT_SOURCE_DIR}/demos/skater/data/menu/menu_music.ogg + DESTINATION ${CMAKE_BINARY_DIR}/demos/shooter/data) +file(RENAME ${CMAKE_BINARY_DIR}/demos/shooter/data/intro_music.ogg + ${CMAKE_BINARY_DIR}/demos/shooter/data/INTRO_MUSIC.ogg) +file(RENAME ${CMAKE_BINARY_DIR}/demos/shooter/data/menu_music.ogg + ${CMAKE_BINARY_DIR}/demos/shooter/data/TITLE_MUSIC.ogg) + + +file(GLOB SHOOTER_DEMO_DATA data/*) + +set(SHOOTER_DATA + ${SHOOTER_DEMO_DATA} + ) +list(APPEND SHOOTER_DATA ${CMAKE_BINARY_DIR}/demos/shooter/data/DejaVuSans.ttf) +list(APPEND SHOOTER_DATA ${CMAKE_BINARY_DIR}/demos/shooter/data/INTRO_MUSIC.ogg) +list(APPEND SHOOTER_DATA ${CMAKE_BINARY_DIR}/demos/shooter/data/TITLE_MUSIC.ogg) + + +set(SHOOTER_REL_DATA) +foreach(data ${SHOOTER_DATA}) + file(RELATIVE_PATH relpath "${CMAKE_CURRENT_SOURCE_DIR}" "${data}") + list(APPEND SHOOTER_REL_DATA "${relpath}") +endforeach(data) + +if(ANDROID) + add_copy_commands( + "${CMAKE_CURRENT_SOURCE_DIR}" + "${CMAKE_CURRENT_BINARY_DIR}/shooter.project/app/src/main/assets" + ASSETS + "${SHOOTER_REL_DATA}" + ) + add_android_app(shooter + "${DEMO_SRCS};${ASSETS}" + ) + return() +endif() + +if(APPLE) + set(DEMO_EXECUTABLE_TYPE MACOSX_BUNDLE) +else(APPLE) + set(DEMO_EXECUTABLE_TYPE "${EXECUTABLE_TYPE}") +endif(APPLE) + +add_executable(shooter + ${DEMO_EXECUTABLE_TYPE} + ${DEMO_SRCS} + ${SHOOTER_DATA} + ) + +fix_executable(shooter) + +if(WANT_MONOLITH) + target_link_libraries(shooter + ${ALLEGRO_MONOLITH_LINK_WITH} + ) +else(WANT_MONOLITH) + target_link_libraries(shooter + ${ACODEC_LINK_WITH} + ${AUDIO_LINK_WITH} + ${FONT_LINK_WITH} + ${IMAGE_LINK_WITH} + ${ALLEGRO_MAIN_LINK_WITH} + ${PRIMITIVES_LINK_WITH} + ${TTF_LINK_WITH} + ) +endif(WANT_MONOLITH) + +if(NOT BUILD_SHARED_LIBS) + set_target_properties(shooter PROPERTIES COMPILE_FLAGS "-DALLEGRO_STATICLINK") +endif(NOT BUILD_SHARED_LIBS) + +# Mac OS X bundle support. +set_target_properties(shooter PROPERTIES + MACOSX_BUNDLE_COPYRIGHT "Copyright 2010 Allegro Developers" + #MACOSX_BUNDLE_ICON_FILE "Icon.icns" + MACOSX_BUNDLE_INFO_STRING "5.1, Copyright 2010 Allegro Developers" + MACOSX_BUNDLE_SHORT_VERSION_STRING "5.1" + MACOSX_BUNDLE_LONG_VERSION_STRING "Allegro Shooter Demo v5.1" + MACOSX_BUNDLE_GUI_IDENTIFIER "org.liballeg.shooter" + ) + +set_source_files_properties(${SHOOTER_DATA} PROPERTIES + MACOSX_PACKAGE_LOCATION "Resources/data" + ) + +copy_data_dir_to_build(copy_shooter_data + "${CMAKE_CURRENT_SOURCE_DIR}/data" + "${CMAKE_CURRENT_BINARY_DIR}/data" + ) + +add_dependencies(shooter copy_shooter_data copy_example_data) + +#-----------------------------------------------------------------------------# +# vi: set ts=8 sts=4 sw=4 et: diff --git a/demos/shooter/aster.c b/demos/shooter/aster.c new file mode 100644 index 0000000000..26b5fe9893 --- /dev/null +++ b/demos/shooter/aster.c @@ -0,0 +1,172 @@ +#include "aster.h" +#include "expl.h" +#include "data.h" +#include "game.h" + +/* info about the asteroids (they used to be asteroids at least, + * even if the current graphics look more like asteroids :-) + */ +#define MAX_ASTEROIDS 50 + +volatile struct { + int x, y; + int d; + int state; + int shot; +} asteroid[MAX_ASTEROIDS]; + +static int asteroid_count; + + + +void init_asteroids(void) +{ + int c; + for (c = 0; c < MAX_ASTEROIDS; c++) { + asteroid[c].x = 16 + AL_RAND() % (SCREEN_W - 32); + asteroid[c].y = -60 - (AL_RAND() & 0x3f); + asteroid[c].d = (AL_RAND() & 1) ? 1 : -1; + asteroid[c].state = -1; + asteroid[c].shot = FALSE; + } + asteroid_count = 2; +} + + + +void scroll_asteroids(void) +{ + int c; + for (c = 0; c < asteroid_count; c++) + asteroid[c].y++; +} + + + +void add_asteroid(void) +{ + if (asteroid_count < MAX_ASTEROIDS) + asteroid_count++; +} + + + +void move_asteroids(void) +{ + int c; + for (c = 0; c < asteroid_count; c++) { + if (asteroid[c].shot) { + /* dying asteroid */ + if (skip_count <= 0) { + if (asteroid[c].state < EXPLODE_FLAG + EXPLODE_FRAMES - 1) { + asteroid[c].state++; + if (asteroid[c].state & 1) + asteroid[c].x += asteroid[c].d; + } + else { + asteroid[c].x = 16 + AL_RAND() % (SCREEN_W - 32); + asteroid[c].y = -60 - (AL_RAND() & 0x3f); + asteroid[c].d = (AL_RAND() & 1) ? 1 : -1; + asteroid[c].shot = FALSE; + asteroid[c].state = -1; + } + } + } + else { + /* move asteroid sideways */ + asteroid[c].x += asteroid[c].d; + if (asteroid[c].x < -60) + asteroid[c].x = SCREEN_W; + else if (asteroid[c].x > SCREEN_W + 60) + asteroid[c].x = -60; + } + + /* move asteroid vertically */ + asteroid[c].y += 1; + + if (asteroid[c].y > SCREEN_H + 30) { + if (!asteroid[c].shot) { + asteroid[c].x = AL_RAND() % (SCREEN_W - 32); + asteroid[c].y = -32 - (AL_RAND() & 0x3f); + asteroid[c].d = (AL_RAND() & 1) ? 1 : -1; + } + } + else { + /* asteroid collided with player? */ + if ((ABS(asteroid[c].x - (player_x_pos >> SPEED_SHIFT)) < 48) + && (ABS(asteroid[c].y - (SCREEN_H - 42)) < 32)) { + if ((!player_hit) && (!asteroid[c].shot)) { + if (!cheat) { + ship_state = EXPLODE_FLAG; + player_hit = TRUE; + } + if ((!cheat) || (!asteroid[c].shot)) + play_sample(data[DEATH_SPL].dat, 255, + PAN(player_x_pos >> SPEED_SHIFT), 1000, FALSE); + } + if (!asteroid[c].shot) { + asteroid[c].shot = TRUE; + asteroid[c].state = EXPLODE_FLAG; + } + } + } + } +} + + + +int asteroid_collision(int x, int y, int s) +{ + int i; + for (i = 0; i < asteroid_count; i++) { + if ((ABS(y - asteroid[i].y) < s) + && (ABS(x - asteroid[i].x) < s) + && (!asteroid[i].shot)) { + asteroid[i].shot = TRUE; + asteroid[i].state = EXPLODE_FLAG; + return 1; + } + } + return 0; +} + + + +void draw_asteroids() +{ + int i, j, c, x, y; + RLE_SPRITE *spr; + for (c = 0; c < asteroid_count; c++) { + x = asteroid[c].x; + y = asteroid[c].y; + + if (asteroid[c].state >= EXPLODE_FLAG) { + spr = explosion[asteroid[c].state - EXPLODE_FLAG]; + } + else { + switch (c % 3) { + case 0: + i = ASTA01; + break; + case 1: + i = ASTB01; + break; + case 2: + i = ASTC01; + break; + default: + i = 0; + break; + } + j = (retrace_count() / (6 - (c & 3)) + c) % 15; + if (c & 1) + spr = (RLE_SPRITE *) data[i + 14 - j].dat; + else + spr = (RLE_SPRITE *) data[i + j].dat; + } + + int sprw = al_get_bitmap_width(spr); + int sprh = al_get_bitmap_height(spr); + draw_sprite(spr, x - sprw / 2, y - sprh / 2); + } +} diff --git a/demos/shooter/aster.h b/demos/shooter/aster.h new file mode 100644 index 0000000000..94399b7a79 --- /dev/null +++ b/demos/shooter/aster.h @@ -0,0 +1,13 @@ +#ifndef ASTER_H_INCLUDED +#define ASTER_H_INCLUDED + +#include "demo.h" + +void init_asteroids(void); +void add_asteroid(void); +void move_asteroids(void); +void scroll_asteroids(void); +void draw_asteroids(void); +int asteroid_collision(int x, int y, int s); + +#endif diff --git a/demos/shooter/bullet.c b/demos/shooter/bullet.c new file mode 100644 index 0000000000..6500379786 --- /dev/null +++ b/demos/shooter/bullet.c @@ -0,0 +1,101 @@ +#include "bullet.h" +#include "data.h" +#include "aster.h" +#include "game.h" + +/* position of the bullets */ +#define BULLET_SPEED 6 + +BULLET *bullet_list; + +/* add a bullet to the list */ +BULLET *add_bullet(int x, int y) +{ + BULLET *iter, *bullet; + + bullet = (BULLET *) malloc(sizeof(BULLET)); + bullet->x = x; + bullet->y = y; + bullet->next = NULL; + + /* special treatment for head */ + if (!bullet_list) { + bullet_list = bullet; + } + else { + for (iter = bullet_list; iter->next; iter = iter->next) ; + + iter->next = bullet; + } + + return bullet; +} + + + +/* delete a bullet and return the next in the list */ +BULLET *delete_bullet(BULLET * bullet) +{ + BULLET *iter; + + /* special treatment for head */ + if (bullet == bullet_list) { + bullet_list = bullet->next; + free(bullet); + return bullet_list; + } + else { + for (iter = bullet_list; iter->next != bullet; iter = iter->next) ; + + iter->next = bullet->next; + free(bullet); + return iter->next; + } +} + + + +void move_bullets(void) +{ + BULLET *bullet = bullet_list; + while (bullet) { + bullet->y -= BULLET_SPEED; + + /* if the bullet is at the top of the screen, delete it */ + if (bullet->y < 8) { + bullet = delete_bullet(bullet); + goto bullet_updated; + } + else { + + /* shot an asteroid? */ + if (asteroid_collision(bullet->x, bullet->y, 20)) { + score += 10; + play_sample(data[BOOM_SPL].dat, 255, PAN(bullet->x), 1000, FALSE); + /* delete the bullet that killed the alien */ + bullet = delete_bullet(bullet); + goto bullet_updated; + } + } + + bullet = bullet->next; + + bullet_updated:; + } +} + + + +void draw_bullets() +{ + BULLET *bullet; + for (bullet = bullet_list; bullet; bullet = bullet->next) { + int x = bullet->x; + int y = bullet->y; + + RLE_SPRITE *spr = data[ROCKET].dat; + int sprw = al_get_bitmap_width(spr); + int sprh = al_get_bitmap_height(spr); + draw_sprite(spr, x - sprw / 2, y - sprh / 2); + } +} diff --git a/demos/shooter/bullet.h b/demos/shooter/bullet.h new file mode 100644 index 0000000000..e622e46210 --- /dev/null +++ b/demos/shooter/bullet.h @@ -0,0 +1,19 @@ +#ifndef BULLET_H_INCLUDED +#define BULLET_H_INCLUDED + +#include "demo.h" + +typedef struct BULLET { + int x; + int y; + struct BULLET *next; +} BULLET; + +extern BULLET *bullet_list; + +BULLET *add_bullet(int x, int y); +BULLET *delete_bullet(BULLET * bullet); +void draw_bullets(void); +void move_bullets(void); + +#endif diff --git a/demos/shooter/data.c b/demos/shooter/data.c new file mode 100644 index 0000000000..af07006e03 --- /dev/null +++ b/demos/shooter/data.c @@ -0,0 +1,658 @@ +#include "demo.h" + +/* our graphics, samples, etc. */ +DATAFILE *data; + +char const *names[] = { + "ASTA01", + "ASTA02", + "ASTA03", + "ASTA04", + "ASTA05", + "ASTA06", + "ASTA07", + "ASTA08", + "ASTA09", + "ASTA10", + "ASTA11", + "ASTA12", + "ASTA13", + "ASTA14", + "ASTA15", + "ASTB01", + "ASTB02", + "ASTB03", + "ASTB04", + "ASTB05", + "ASTB06", + "ASTB07", + "ASTB08", + "ASTB09", + "ASTB10", + "ASTB11", + "ASTB12", + "ASTB13", + "ASTB14", + "ASTB15", + "ASTC01", + "ASTC02", + "ASTC03", + "ASTC04", + "ASTC05", + "ASTC06", + "ASTC07", + "ASTC08", + "ASTC09", + "ASTC10", + "ASTC11", + "ASTC12", + "ASTC13", + "ASTC14", + "ASTC15", + "BOOM_SPL", + "DEATH_SPL", + "END_FONT", + "ENGINE1", + "ENGINE2", + "ENGINE3", + "ENGINE4", + "ENGINE5", + "ENGINE6", + "ENGINE7", + "ENGINE_SPL", + "GAME_MUSIC", + "GAME_PAL", + "GO_BMP", + "INTRO_ANIM", + "INTRO_BMP_1", + "INTRO_BMP_2", + "INTRO_BMP_3", + "INTRO_BMP_4", + "INTRO_MUSIC", + "INTRO_SPL", + "ROCKET", + "SHIP1", + "SHIP2", + "SHIP3", + "SHIP4", + "SHIP5", + "SHOOT_SPL", + "TITLE_BMP", + "TITLE_FONT", + "TITLE_MUSIC", + "TITLE_PAL", + "WELCOME_SPL", +}; + +int title_pal[]; +int game_pal[]; +ALLEGRO_BITMAP *ast; + +static PALETTE *_make_pal(int *pal) { + PALETTE *p = al_calloc(1, sizeof *p); + for (int i = 0; i < 256; i++) { + p->rgb[i] = al_map_rgb(pal[i * 3 + 0], pal[i * 3 + 1], pal[i * 3 + 2]); + } + return p; +} + +void data_load(void) { + data = al_calloc(DATA_COUNT, sizeof *data); + ast = al_load_bitmap("data/AST.png"); + for (int i = 0; i < DATA_COUNT; i++) { + char name[1000]; + if (i == END_FONT) { + data[END_FONT].dat = al_load_font("data/DejaVuSans.ttf", 48, 0);; + } + if (i == TITLE_FONT) { + data[TITLE_FONT].dat = al_load_font("data/DejaVuSans.ttf", 24, 0); + } + if (i == GAME_MUSIC || i == TITLE_MUSIC || i == INTRO_MUSIC) { + sprintf(name, "data/%s.ogg", names[i]); + data[i].dat = strdup(name); + } + if (i == TITLE_PAL) { + data[i].dat = _make_pal(title_pal); + } + if (i == GAME_PAL) { + data[i].dat = _make_pal(game_pal); + } + if (i >= ASTA01 && i <= ASTC15) { + int j = i - ASTA01; + int x = j % 8; + int y = j / 8; + data[i].dat = al_create_sub_bitmap(ast, x * 60, y * 60, 60, 60); + } + if (!data[i].dat) { + sprintf(name, "data/%s.png", names[i]); + data[i].dat = al_load_bitmap(name); + } + if (!data[i].dat) { + sprintf(name, "data/%s.wav", names[i]); + data[i].dat = al_load_sample(name); + } + if (!data[i].dat) { + printf("Could not load %s.\n", name); + } + } +} + + + +int title_pal[] = { + 0, 0, 0, + 48, 48, 81, + 28, 28, 101, + 60, 60, 109, + 101, 101, 162, + 142, 142, 203, + 190, 190, 243, + 255, 255, 255, + 0, 0, 0, + 4, 0, 0, + 4, 0, 0, + 8, 0, 0, + 8, 0, 0, + 12, 0, 0, + 12, 0, 0, + 16, 0, 0, + 16, 0, 0, + 20, 0, 0, + 20, 0, 0, + 24, 0, 0, + 24, 0, 0, + 28, 0, 0, + 28, 0, 0, + 32, 0, 0, + 32, 0, 0, + 36, 0, 0, + 40, 0, 0, + 40, 0, 0, + 44, 0, 0, + 44, 0, 0, + 48, 0, 0, + 48, 0, 0, + 52, 0, 0, + 52, 0, 0, + 56, 0, 0, + 56, 0, 0, + 60, 0, 0, + 60, 0, 0, + 65, 0, 0, + 65, 0, 0, + 69, 0, 0, + 69, 0, 0, + 73, 0, 0, + 77, 0, 0, + 77, 0, 0, + 81, 0, 0, + 81, 0, 0, + 85, 0, 0, + 85, 0, 0, + 89, 0, 0, + 89, 0, 0, + 93, 0, 0, + 93, 0, 0, + 97, 0, 0, + 97, 0, 0, + 101, 0, 0, + 101, 0, 0, + 105, 0, 0, + 105, 0, 0, + 109, 0, 0, + 113, 0, 0, + 113, 0, 0, + 117, 0, 0, + 117, 0, 0, + 121, 0, 0, + 121, 0, 0, + 125, 0, 0, + 125, 0, 0, + 130, 0, 0, + 130, 0, 0, + 134, 0, 0, + 134, 0, 0, + 138, 0, 0, + 138, 0, 0, + 142, 0, 0, + 142, 0, 0, + 146, 0, 0, + 150, 0, 0, + 150, 0, 0, + 154, 0, 0, + 154, 0, 0, + 158, 0, 0, + 158, 0, 0, + 162, 0, 0, + 162, 0, 0, + 166, 0, 0, + 166, 0, 0, + 170, 0, 0, + 170, 0, 0, + 174, 0, 0, + 174, 0, 0, + 178, 0, 0, + 178, 0, 0, + 182, 0, 0, + 186, 0, 0, + 186, 0, 0, + 190, 0, 0, + 190, 0, 0, + 195, 0, 0, + 195, 0, 0, + 199, 0, 0, + 199, 0, 0, + 203, 0, 0, + 203, 0, 0, + 207, 0, 0, + 207, 0, 0, + 211, 0, 0, + 211, 0, 0, + 215, 0, 0, + 215, 0, 0, + 219, 0, 0, + 223, 0, 0, + 223, 0, 0, + 227, 0, 0, + 227, 0, 0, + 231, 0, 0, + 231, 0, 0, + 235, 0, 0, + 235, 0, 0, + 239, 0, 0, + 239, 0, 0, + 243, 0, 0, + 243, 0, 0, + 247, 0, 0, + 247, 0, 0, + 251, 0, 0, + 251, 0, 0, + 255, 0, 0, + 0, 0, 0, + 0, 0, 0, + 4, 4, 4, + 4, 4, 4, + 8, 8, 8, + 8, 8, 8, + 12, 12, 12, + 12, 12, 12, + 16, 16, 16, + 16, 16, 16, + 20, 20, 20, + 20, 20, 20, + 24, 24, 24, + 24, 24, 24, + 28, 28, 28, + 28, 28, 28, + 32, 32, 32, + 32, 32, 32, + 36, 36, 36, + 36, 36, 36, + 40, 40, 40, + 40, 40, 40, + 44, 44, 44, + 44, 44, 44, + 48, 48, 48, + 48, 48, 48, + 52, 52, 52, + 52, 52, 52, + 56, 56, 56, + 56, 56, 56, + 60, 60, 60, + 60, 60, 60, + 65, 65, 65, + 65, 65, 65, + 69, 69, 69, + 69, 69, 69, + 73, 73, 73, + 73, 73, 73, + 77, 77, 77, + 77, 77, 77, + 81, 81, 81, + 81, 81, 81, + 85, 85, 85, + 85, 85, 85, + 89, 89, 89, + 89, 89, 89, + 93, 93, 93, + 93, 93, 93, + 97, 97, 97, + 97, 97, 97, + 101, 101, 101, + 101, 101, 101, + 105, 105, 105, + 105, 105, 105, + 109, 109, 109, + 109, 109, 109, + 113, 113, 113, + 113, 113, 113, + 117, 117, 117, + 117, 117, 117, + 121, 121, 121, + 121, 121, 121, + 125, 125, 125, + 125, 125, 125, + 130, 130, 130, + 130, 130, 130, + 134, 134, 134, + 134, 134, 134, + 138, 138, 138, + 138, 138, 138, + 142, 142, 142, + 142, 142, 142, + 146, 146, 146, + 146, 146, 146, + 150, 150, 150, + 150, 150, 150, + 154, 154, 154, + 154, 154, 154, + 158, 158, 158, + 158, 158, 158, + 162, 162, 162, + 162, 162, 162, + 166, 166, 166, + 166, 166, 166, + 170, 170, 170, + 170, 170, 170, + 174, 174, 174, + 174, 174, 174, + 178, 178, 178, + 178, 178, 178, + 182, 182, 182, + 182, 182, 182, + 186, 186, 186, + 186, 186, 186, + 190, 190, 190, + 190, 190, 190, + 195, 195, 195, + 195, 195, 195, + 199, 199, 199, + 199, 199, 199, + 203, 203, 203, + 203, 203, 203, + 207, 207, 207, + 207, 207, 207, + 211, 211, 211, + 211, 211, 211, + 215, 215, 215, + 215, 215, 215, + 219, 219, 219, + 219, 219, 219, + 223, 223, 223, + 223, 223, 223, + 227, 227, 227, + 227, 227, 227, + 231, 231, 231, + 231, 231, 231, + 235, 235, 235, + 235, 235, 235, + 239, 239, 239, + 239, 239, 239, + 243, 243, 243, + 243, 243, 243, + 247, 247, 247, + 247, 247, 247, + 251, 251, 251, + 251, 251, 251, + 255, 255, 255, + 255, 255, 255, +}; + +int game_pal[] = { + 0, 0, 0, + 255, 255, 255, + 0, 162, 255, + 0, 255, 0, + 255, 255, 0, + 255, 0, 0, + 0, 0, 0, + 162, 162, 162, + 0, 0, 117, + 0, 0, 162, + 0, 125, 211, + 130, 56, 255, + 0, 199, 255, + 130, 154, 195, + 223, 255, 186, + 255, 255, 255, + 0, 0, 0, + 16, 0, 0, + 44, 0, 0, + 73, 0, 0, + 101, 0, 0, + 130, 0, 0, + 162, 0, 0, + 195, 0, 0, + 227, 0, 0, + 255, 0, 0, + 255, 101, 0, + 255, 150, 0, + 255, 199, 0, + 255, 255, 0, + 255, 255, 125, + 255, 255, 255, + 93, 56, 12, + 101, 65, 16, + 73, 56, 36, + 109, 105, 77, + 125, 81, 24, + 97, 56, 12, + 255, 255, 65, + 52, 32, 8, + 93, 52, 16, + 117, 73, 20, + 130, 85, 24, + 73, 69, 48, + 48, 36, 24, + 44, 40, 28, + 255, 243, 56, + 69, 56, 36, + 73, 60, 40, + 85, 81, 60, + 142, 97, 28, + 121, 117, 85, + 150, 105, 28, + 101, 97, 69, + 60, 48, 28, + 101, 97, 73, + 65, 60, 44, + 146, 142, 105, + 77, 73, 52, + 32, 20, 4, + 40, 36, 24, + 121, 117, 89, + 138, 134, 97, + 142, 138, 101, + 121, 77, 20, + 8, 8, 4, + 81, 65, 40, + 8, 4, 4, + 81, 60, 40, + 85, 81, 56, + 89, 73, 48, + 77, 73, 56, + 48, 44, 32, + 52, 48, 36, + 255, 255, 73, + 113, 109, 81, + 255, 219, 52, + 56, 44, 24, + 40, 32, 20, + 125, 81, 20, + 186, 178, 134, + 56, 52, 40, + 150, 146, 105, + 89, 44, 8, + 182, 174, 130, + 162, 109, 32, + 125, 121, 89, + 138, 85, 24, + 89, 85, 65, + 255, 154, 16, + 255, 211, 48, + 130, 125, 93, + 109, 105, 81, + 65, 32, 4, + 117, 73, 24, + 255, 207, 48, + 134, 130, 93, + 154, 146, 109, + 56, 40, 20, + 36, 32, 24, + 60, 48, 32, + 97, 52, 16, + 162, 154, 113, + 166, 158, 121, + 0, 0, 0, + 60, 32, 4, + 158, 150, 113, + 97, 52, 12, + 65, 60, 48, + 130, 125, 89, + 93, 56, 16, + 113, 109, 77, + 81, 69, 48, + 12, 12, 8, + 146, 97, 28, + 77, 65, 44, + 146, 138, 101, + 73, 52, 32, + 16, 12, 8, + 28, 16, 4, + 125, 121, 85, + 130, 81, 20, + 12, 8, 0, + 101, 56, 16, + 130, 77, 20, + 255, 255, 60, + 20, 16, 8, + 65, 44, 24, + 52, 48, 32, + 81, 16, 0, + 52, 40, 20, + 158, 154, 113, + 134, 130, 97, + 85, 73, 44, + 65, 48, 24, + 16, 8, 0, + 121, 69, 16, + 36, 32, 20, + 89, 77, 56, + 142, 97, 24, + 109, 73, 20, + 255, 227, 56, + 32, 28, 16, + 52, 40, 24, + 134, 125, 97, + 255, 235, 52, + 65, 65, 44, + 255, 69, 8, + 81, 65, 36, + 44, 40, 32, + 113, 69, 24, + 130, 77, 24, + 255, 235, 56, + 255, 162, 16, + 52, 44, 32, + 109, 73, 16, + 97, 56, 16, + 166, 162, 117, + 138, 85, 20, + 52, 40, 28, + 65, 48, 28, + 142, 138, 105, + 109, 69, 24, + 77, 65, 36, + 255, 199, 48, + 73, 69, 52, + 255, 146, 16, + 60, 56, 36, + 134, 89, 20, + 24, 12, 0, + 69, 56, 40, + 255, 227, 52, + 138, 134, 93, + 255, 251, 60, + 255, 89, 16, + 85, 73, 48, + 158, 154, 109, + 150, 97, 32, + 255, 239, 56, + 73, 60, 48, + 150, 146, 109, + 73, 52, 24, + 121, 73, 20, + 65, 56, 40, + 255, 150, 16, + 255, 97, 8, + 255, 44, 4, + 16, 16, 12, + 56, 56, 36, + 255, 231, 56, + 56, 44, 28, + 255, 142, 16, + 255, 178, 16, + 255, 138, 16, + 16, 0, 0, + 255, 121, 16, + 255, 158, 16, + 255, 134, 16, + 255, 170, 16, + 16, 4, 0, + 255, 65, 8, + 20, 8, 0, + 48, 8, 0, + 255, 52, 8, + 255, 105, 12, + 56, 12, 0, + 255, 113, 16, + 24, 4, 0, + 255, 130, 16, + 40, 8, 0, + 255, 97, 16, + 28, 8, 0, + 65, 16, 0, + 32, 8, 0, + 255, 60, 8, + 255, 48, 4, + 255, 117, 16, + 255, 146, 12, + 73, 16, 0, + 24, 8, 0, + 255, 130, 12, + 255, 125, 16, + 255, 56, 8, + 255, 154, 12, + 36, 8, 0, + 32, 4, 0, + 255, 162, 12, + 255, 56, 4, + 255, 109, 16, + 65, 12, 0, + 255, 138, 12, + 44, 8, 0, + 40, 4, 0, + 255, 142, 12, + 255, 105, 16, + 255, 65, 4, + 81, 48, 174, + 174, 174, 81, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 65, 182, 65, + 52, 81, 81, + 109, 81, 182, + 81, 101, 247, + 113, 109, 97, + 215, 109, 113, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + 203, 65, 203, + 154, 81, 81, + 215, 251, 166, + 0, 0, 0, +}; diff --git a/demos/shooter/data.h b/demos/shooter/data.h new file mode 100644 index 0000000000..9a02bb3c69 --- /dev/null +++ b/demos/shooter/data.h @@ -0,0 +1,88 @@ +/* Allegro datafile object indexes, produced by grabber v3.11 */ +/* Datafile: e:\allegro\demo\demo.dat */ +/* Date: Fri Apr 9 15:55:51 1999 */ +/* Do not hand edit! */ + +#define ASTA01 0 /* RLE */ +#define ASTA02 1 /* RLE */ +#define ASTA03 2 /* RLE */ +#define ASTA04 3 /* RLE */ +#define ASTA05 4 /* RLE */ +#define ASTA06 5 /* RLE */ +#define ASTA07 6 /* RLE */ +#define ASTA08 7 /* RLE */ +#define ASTA09 8 /* RLE */ +#define ASTA10 9 /* RLE */ +#define ASTA11 10 /* RLE */ +#define ASTA12 11 /* RLE */ +#define ASTA13 12 /* RLE */ +#define ASTA14 13 /* RLE */ +#define ASTA15 14 /* RLE */ +#define ASTB01 15 /* RLE */ +#define ASTB02 16 /* RLE */ +#define ASTB03 17 /* RLE */ +#define ASTB04 18 /* RLE */ +#define ASTB05 19 /* RLE */ +#define ASTB06 20 /* RLE */ +#define ASTB07 21 /* RLE */ +#define ASTB08 22 /* RLE */ +#define ASTB09 23 /* RLE */ +#define ASTB10 24 /* RLE */ +#define ASTB11 25 /* RLE */ +#define ASTB12 26 /* RLE */ +#define ASTB13 27 /* RLE */ +#define ASTB14 28 /* RLE */ +#define ASTB15 29 /* RLE */ +#define ASTC01 30 /* RLE */ +#define ASTC02 31 /* RLE */ +#define ASTC03 32 /* RLE */ +#define ASTC04 33 /* RLE */ +#define ASTC05 34 /* RLE */ +#define ASTC06 35 /* RLE */ +#define ASTC07 36 /* RLE */ +#define ASTC08 37 /* RLE */ +#define ASTC09 38 /* RLE */ +#define ASTC10 39 /* RLE */ +#define ASTC11 40 /* RLE */ +#define ASTC12 41 /* RLE */ +#define ASTC13 42 /* RLE */ +#define ASTC14 43 /* RLE */ +#define ASTC15 44 /* RLE */ +#define BOOM_SPL 45 /* SAMP */ +#define DEATH_SPL 46 /* SAMP */ +#define END_FONT 47 /* FONT */ +#define ENGINE1 48 /* RLE */ +#define ENGINE2 49 /* RLE */ +#define ENGINE3 50 /* RLE */ +#define ENGINE4 51 /* RLE */ +#define ENGINE5 52 /* RLE */ +#define ENGINE6 53 /* RLE */ +#define ENGINE7 54 /* RLE */ +#define ENGINE_SPL 55 /* SAMP */ +#define GAME_MUSIC 56 /* MIDI */ +#define GAME_PAL 57 /* PAL */ +#define GO_BMP 58 /* BMP */ +#define INTRO_ANIM 59 /* FLIC */ +#define INTRO_BMP_1 60 /* BMP */ +#define INTRO_BMP_2 61 /* BMP */ +#define INTRO_BMP_3 62 /* BMP */ +#define INTRO_BMP_4 63 /* BMP */ +#define INTRO_MUSIC 64 /* MIDI */ +#define INTRO_SPL 65 /* SAMP */ +#define ROCKET 66 /* RLE */ +#define SHIP1 67 /* RLE */ +#define SHIP2 68 /* RLE */ +#define SHIP3 69 /* RLE */ +#define SHIP4 70 /* RLE */ +#define SHIP5 71 /* RLE */ +#define SHOOT_SPL 72 /* SAMP */ +#define TITLE_BMP 73 /* BMP */ +#define TITLE_FONT 74 /* FONT */ +#define TITLE_MUSIC 75 /* MIDI */ +#define TITLE_PAL 76 /* PAL */ +#define WELCOME_SPL 77 /* SAMP */ +#define DATA_COUNT 78 + +extern DATAFILE *data; +void data_load(void); +void unload_datafile(void); diff --git a/demos/shooter/data/AST.png b/demos/shooter/data/AST.png new file mode 100644 index 0000000000..151053e717 Binary files /dev/null and b/demos/shooter/data/AST.png differ diff --git a/demos/shooter/data/BOOM_SPL.wav b/demos/shooter/data/BOOM_SPL.wav new file mode 100644 index 0000000000..a98642933e Binary files /dev/null and b/demos/shooter/data/BOOM_SPL.wav differ diff --git a/demos/shooter/data/DEATH_SPL.wav b/demos/shooter/data/DEATH_SPL.wav new file mode 100644 index 0000000000..1b6a84c49d Binary files /dev/null and b/demos/shooter/data/DEATH_SPL.wav differ diff --git a/demos/shooter/data/ENGINE1.png b/demos/shooter/data/ENGINE1.png new file mode 100644 index 0000000000..ac75a729e7 Binary files /dev/null and b/demos/shooter/data/ENGINE1.png differ diff --git a/demos/shooter/data/ENGINE2.png b/demos/shooter/data/ENGINE2.png new file mode 100644 index 0000000000..e1effa31dc Binary files /dev/null and b/demos/shooter/data/ENGINE2.png differ diff --git a/demos/shooter/data/ENGINE3.png b/demos/shooter/data/ENGINE3.png new file mode 100644 index 0000000000..36471a8aa8 Binary files /dev/null and b/demos/shooter/data/ENGINE3.png differ diff --git a/demos/shooter/data/ENGINE4.png b/demos/shooter/data/ENGINE4.png new file mode 100644 index 0000000000..739a667eb5 Binary files /dev/null and b/demos/shooter/data/ENGINE4.png differ diff --git a/demos/shooter/data/ENGINE5.png b/demos/shooter/data/ENGINE5.png new file mode 100644 index 0000000000..94000f13a2 Binary files /dev/null and b/demos/shooter/data/ENGINE5.png differ diff --git a/demos/shooter/data/ENGINE6.png b/demos/shooter/data/ENGINE6.png new file mode 100644 index 0000000000..296a406fd6 Binary files /dev/null and b/demos/shooter/data/ENGINE6.png differ diff --git a/demos/shooter/data/ENGINE7.png b/demos/shooter/data/ENGINE7.png new file mode 100644 index 0000000000..9acc2a0914 Binary files /dev/null and b/demos/shooter/data/ENGINE7.png differ diff --git a/demos/shooter/data/ENGINE_SPL.wav b/demos/shooter/data/ENGINE_SPL.wav new file mode 100644 index 0000000000..22d91a6944 Binary files /dev/null and b/demos/shooter/data/ENGINE_SPL.wav differ diff --git a/demos/shooter/data/GAME_MUSIC.ogg b/demos/shooter/data/GAME_MUSIC.ogg new file mode 100644 index 0000000000..8e2be94763 Binary files /dev/null and b/demos/shooter/data/GAME_MUSIC.ogg differ diff --git a/demos/shooter/data/GO_BMP.png b/demos/shooter/data/GO_BMP.png new file mode 100644 index 0000000000..c9055fc131 Binary files /dev/null and b/demos/shooter/data/GO_BMP.png differ diff --git a/demos/shooter/data/INTRO_ANIM.png b/demos/shooter/data/INTRO_ANIM.png new file mode 100644 index 0000000000..70cca8e8a4 Binary files /dev/null and b/demos/shooter/data/INTRO_ANIM.png differ diff --git a/demos/shooter/data/INTRO_BMP_1.png b/demos/shooter/data/INTRO_BMP_1.png new file mode 100644 index 0000000000..c5dc21227c Binary files /dev/null and b/demos/shooter/data/INTRO_BMP_1.png differ diff --git a/demos/shooter/data/INTRO_BMP_2.png b/demos/shooter/data/INTRO_BMP_2.png new file mode 100644 index 0000000000..3dfce1e83d Binary files /dev/null and b/demos/shooter/data/INTRO_BMP_2.png differ diff --git a/demos/shooter/data/INTRO_BMP_3.png b/demos/shooter/data/INTRO_BMP_3.png new file mode 100644 index 0000000000..0e4b7bf0fc Binary files /dev/null and b/demos/shooter/data/INTRO_BMP_3.png differ diff --git a/demos/shooter/data/INTRO_BMP_4.png b/demos/shooter/data/INTRO_BMP_4.png new file mode 100644 index 0000000000..630c42a728 Binary files /dev/null and b/demos/shooter/data/INTRO_BMP_4.png differ diff --git a/demos/shooter/data/INTRO_SPL.wav b/demos/shooter/data/INTRO_SPL.wav new file mode 100644 index 0000000000..4111d75fa1 Binary files /dev/null and b/demos/shooter/data/INTRO_SPL.wav differ diff --git a/demos/shooter/data/ROCKET.png b/demos/shooter/data/ROCKET.png new file mode 100644 index 0000000000..d49d86adbb Binary files /dev/null and b/demos/shooter/data/ROCKET.png differ diff --git a/demos/shooter/data/SHIP1.png b/demos/shooter/data/SHIP1.png new file mode 100644 index 0000000000..860078ef6e Binary files /dev/null and b/demos/shooter/data/SHIP1.png differ diff --git a/demos/shooter/data/SHIP2.png b/demos/shooter/data/SHIP2.png new file mode 100644 index 0000000000..7a49b65d43 Binary files /dev/null and b/demos/shooter/data/SHIP2.png differ diff --git a/demos/shooter/data/SHIP3.png b/demos/shooter/data/SHIP3.png new file mode 100644 index 0000000000..d829cd544b Binary files /dev/null and b/demos/shooter/data/SHIP3.png differ diff --git a/demos/shooter/data/SHIP4.png b/demos/shooter/data/SHIP4.png new file mode 100644 index 0000000000..40040bc561 Binary files /dev/null and b/demos/shooter/data/SHIP4.png differ diff --git a/demos/shooter/data/SHIP5.png b/demos/shooter/data/SHIP5.png new file mode 100644 index 0000000000..f4c2925517 Binary files /dev/null and b/demos/shooter/data/SHIP5.png differ diff --git a/demos/shooter/data/SHOOT_SPL.wav b/demos/shooter/data/SHOOT_SPL.wav new file mode 100644 index 0000000000..42503cb15f Binary files /dev/null and b/demos/shooter/data/SHOOT_SPL.wav differ diff --git a/demos/shooter/data/TITLE_BMP.png b/demos/shooter/data/TITLE_BMP.png new file mode 100644 index 0000000000..445147aeca Binary files /dev/null and b/demos/shooter/data/TITLE_BMP.png differ diff --git a/demos/shooter/data/WELCOME_SPL.wav b/demos/shooter/data/WELCOME_SPL.wav new file mode 100644 index 0000000000..23555b3dd1 Binary files /dev/null and b/demos/shooter/data/WELCOME_SPL.wav differ diff --git a/demos/shooter/data/text.ini b/demos/shooter/data/text.ini new file mode 100644 index 0000000000..8f04449a38 --- /dev/null +++ b/demos/shooter/data/text.ini @@ -0,0 +1,1262 @@ +[credits] +0=Shawn Hargreaves +0_0=Progenitor. Wrote everything that wasn't written by somebody else. +0_1=addons/allegrogl/examp/excamera.c +0_2=demos/skater/source/menuabt.c +0_3=docs/src/makedoc/makedoc.c +0_4=docs/src/makedoc/makehtml.c +0_5=docs/src/makedoc/makeman.c +0_6=docs/src/makedoc/makemisc.c +0_7=docs/src/makedoc/makertf.c +0_8=docs/src/makedoc/maketexi.c +0_9=docs/src/makedoc/maketxt.c +0_10=examples/ex3buf.c +0_11=examples/ex3d.c +0_12=examples/exaccel.c +0_13=examples/exalpha.c +0_14=examples/exbitmap.c +0_15=examples/exblend.c +0_16=examples/excamera.c +0_17=examples/excustom.c +0_18=examples/exdata.c +0_19=examples/exdbuf.c +0_20=examples/exfixed.c +0_21=examples/exflame.c +0_22=examples/exflip.c +0_23=examples/exhello.c +0_24=examples/exkeys.c +0_25=examples/exlights.c +0_26=examples/exmem.c +0_27=examples/exmidi.c +0_28=examples/exmouse.c +0_29=examples/expal.c +0_30=examples/expat.c +0_31=examples/exrgbhsv.c +0_32=examples/exsample.c +0_33=examples/exscroll.c +0_34=examples/exspline.c +0_35=examples/exstream.c +0_36=examples/exswitch.c +0_37=examples/extimer.c +0_38=examples/extruec.c +0_39=examples/exupdate.c +0_40=examples/exxfade.c +0_41=include/allegro.h +0_42=include/allegro/3d.h +0_43=include/allegro/3dmaths.h +0_44=include/allegro/alcompat.h +0_45=include/allegro/alinline.h +0_46=include/allegro/base.h +0_47=include/allegro/color.h +0_48=include/allegro/compiled.h +0_49=include/allegro/config.h +0_50=include/allegro/datafile.h +0_51=include/allegro/debug.h +0_52=include/allegro/digi.h +0_53=include/allegro/draw.h +0_54=include/allegro/file.h +0_55=include/allegro/fix.h +0_56=include/allegro/fixed.h +0_57=include/allegro/fli.h +0_58=include/allegro/fmaths.h +0_59=include/allegro/gfx.h +0_60=include/allegro/graphics.h +0_61=include/allegro/gui.h +0_62=include/allegro/internal/aintern.h +0_63=include/allegro/internal/aintvga.h +0_64=include/allegro/internal/alconfig.h +0_65=include/allegro/joystick.h +0_66=include/allegro/keyboard.h +0_67=include/allegro/lzss.h +0_68=include/allegro/matrix.h +0_69=include/allegro/midi.h +0_70=include/allegro/mouse.h +0_71=include/allegro/palette.h +0_72=include/allegro/platform/aintdos.h +0_73=include/allegro/platform/aintunix.h +0_74=include/allegro/platform/al386gcc.h +0_75=include/allegro/platform/al386wat.h +0_76=include/allegro/platform/aldjgpp.h +0_77=include/allegro/platform/aldos.h +0_78=include/allegro/platform/almsvc.h +0_79=include/allegro/platform/alwatcom.h +0_80=include/allegro/platform/alwin.h +0_81=include/allegro/quat.h +0_82=include/allegro/rle.h +0_83=include/allegro/sound.h +0_84=include/allegro/stream.h +0_85=include/allegro/system.h +0_86=include/allegro/text.h +0_87=include/allegro/timer.h +0_88=include/allegro/unicode.h +0_89=include/winalleg.h +0_90=setup/keyconf.c +0_91=setup/setup.c +0_92=src/allegro.c +0_93=src/amd64/asmdefs.inc +0_94=src/blit.c +0_95=src/c/cmiscs.s +0_96=src/color.c +0_97=src/config.c +0_98=src/datafile.c +0_99=src/dataregi.c +0_100=src/digmid.c +0_101=src/dispsw.c +0_102=src/dos/adlib.c +0_103=src/dos/dfile.c +0_104=src/dos/dgfxdrv.c +0_105=src/dos/djirq.c +0_106=src/dos/djirqs.s +0_107=src/dos/djoydrv.c +0_108=src/dos/dkeybd.c +0_109=src/dos/dma.c +0_110=src/dos/dmouse.c +0_111=src/dos/dpmi.c +0_112=src/dos/dsnddrv.c +0_113=src/dos/dsystem.c +0_114=src/dos/dtimer.c +0_115=src/dos/joystd.c +0_116=src/dos/mpu.c +0_117=src/dos/sb.c +0_118=src/dos/vesa.c +0_119=src/dos/vesas.s +0_120=src/dos/wat.c +0_121=src/file.c +0_122=src/fli.c +0_123=src/flood.c +0_124=src/fontbios.c +0_125=src/fontbmp.c +0_126=src/fsel.c +0_127=src/gfx.c +0_128=src/glyph.c +0_129=src/graphics.c +0_130=src/gui.c +0_131=src/guiproc.c +0_132=src/i386/asmdefs.inc +0_133=src/i386/blit.inc +0_134=src/i386/iblit16.s +0_135=src/i386/iblit32.s +0_136=src/i386/iblit8.s +0_137=src/i386/icsprite.c +0_138=src/i386/igfx15.s +0_139=src/i386/igfx16.s +0_140=src/i386/igfx32.s +0_141=src/i386/igfx8.s +0_142=src/i386/imisc.s +0_143=src/i386/ispr15.s +0_144=src/i386/ispr16.s +0_145=src/i386/ispr32.s +0_146=src/i386/ispr8.s +0_147=src/i386/istretch.c +0_148=src/i386/opcodes.h +0_149=src/i386/sprite.inc +0_150=src/inline.c +0_151=src/joystick.c +0_152=src/keyboard.c +0_153=src/linux/fbcon.c +0_154=src/lzss.c +0_155=src/mac/msnd.c +0_156=src/math.c +0_157=src/math3d.c +0_158=src/midi.c +0_159=src/misc/modex.c +0_160=src/misc/modexgfx.s +0_161=src/misc/pckeys.c +0_162=src/misc/vbeaf.c +0_163=src/misc/vbeafex.c +0_164=src/misc/vbeafs.s +0_165=src/misc/vga.c +0_166=src/misc/vgaregs.c +0_167=src/mixer.c +0_168=src/modesel.c +0_169=src/mouse.c +0_170=src/pcx.c +0_171=src/poly3d.c +0_172=src/polygon.c +0_173=src/readbmp.c +0_174=src/rle.c +0_175=src/rotate.c +0_176=src/rsfb.c +0_177=src/sound.c +0_178=src/stream.c +0_179=src/text.c +0_180=src/timer.c +0_181=src/unicode.c +0_182=src/unix/ujoydrv.c +0_183=src/vtable.c +0_184=src/vtable15.c +0_185=src/vtable16.c +0_186=src/vtable24.c +0_187=src/vtable32.c +0_188=src/vtable8.c +0_189=src/win/wddaccel.c +0_190=src/win/wfile.c +0_191=src/win/wgfxdrv.c +0_192=src/win/wjoydrv.c +0_193=src/win/wsnddrv.c +0_194=tests/afinfo.c +0_195=tests/akaitest.c +0_196=tests/digitest.c +0_197=tests/filetest.c +0_198=tests/mathtest.c +0_199=tests/miditest.c +0_200=tests/play.c +0_201=tests/playfli.c +0_202=tests/test.c +0_203=tests/vesainfo.c +0_204=tests/win/dibgrab.c +0_205=tests/win/scrsave.c +0_206=tools/colormap.c +0_207=tools/dat.c +0_208=tools/dat2s.c +0_209=tools/datedit.c +0_210=tools/datedit.h +0_211=tools/exedat.c +0_212=tools/grabber.c +0_213=tools/pack.c +0_214=tools/pat2dat.c +0_215=tools/plugins/datalpha.c +0_216=tools/plugins/datfli.c +0_217=tools/plugins/datfont.c +0_218=tools/plugins/datgrab.c +0_219=tools/plugins/datgrid.c +0_220=tools/plugins/datimage.c +0_221=tools/plugins/datitype.c +0_222=tools/plugins/datmidi.c +0_223=tools/plugins/datpal.c +0_224=tools/plugins/datsamp.c +0_225=tools/plugins/datworms.c +0_226=tools/rgbmap.c +0_227=tools/textconv.c +1=Michael Bukin +1_0=Ported the whole thing to Unix/X, and contributed a _lot_ of patches to improve the portability, robustness, and performance of pretty much the entire library. +1_1=include/allegro/platform/alucfg.h +1_2=include/allegro/platform/alunix.h +1_3=src/c/cblit.h +1_4=src/c/cblit16.c +1_5=src/c/cblit24.c +1_6=src/c/cblit32.c +1_7=src/c/cblit8.c +1_8=src/c/ccpu.c +1_9=src/c/ccsprite.c +1_10=src/c/cdefs15.h +1_11=src/c/cdefs16.h +1_12=src/c/cdefs24.h +1_13=src/c/cdefs32.h +1_14=src/c/cdefs8.h +1_15=src/c/cgfx.h +1_16=src/c/cgfx15.c +1_17=src/c/cgfx16.c +1_18=src/c/cgfx24.c +1_19=src/c/cgfx32.c +1_20=src/c/cgfx8.c +1_21=src/c/cmisc.c +1_22=src/c/cscan.h +1_23=src/c/cscan15.c +1_24=src/c/cscan16.c +1_25=src/c/cscan24.c +1_26=src/c/cscan32.c +1_27=src/c/cscan8.c +1_28=src/c/cspr.h +1_29=src/c/cspr15.c +1_30=src/c/cspr16.c +1_31=src/c/cspr24.c +1_32=src/c/cspr32.c +1_33=src/c/cspr8.c +1_34=src/c/cstretch.c +1_35=src/c/czscan.h +1_36=src/c/czscan15.c +1_37=src/c/czscan16.c +1_38=src/c/czscan24.c +1_39=src/c/czscan32.c +1_40=src/c/czscan8.c +1_41=src/fli.c +1_42=src/gfx.c +1_43=src/libc.c +1_44=src/qnx/qkeydrv.c +1_45=src/qnx/qmouse.c +1_46=src/qnx/qsystem.c +1_47=src/quantize.c +1_48=src/unix/udjgpp.c +1_49=src/unix/uesd.c +1_50=src/unix/ufile.c +1_51=src/unix/ugfxdrv.c +1_52=src/unix/ukeybd.c +1_53=src/unix/umain.c +1_54=src/unix/umouse.c +1_55=src/unix/uoss.c +1_56=src/unix/usigalrm.c +1_57=src/unix/usnddrv.c +1_58=src/unix/ustimer.c +1_59=src/unix/usystem.c +1_60=src/x/xgfxdrv.c +1_61=src/x/xmouse.c +1_62=src/x/xsystem.c +1_63=src/x/xtimer.c +1_64=src/x/xvtable.c +1_65=src/x/xwin.c +1_66=src/x/xwin.h +1_67=src/x/xwins.s +1_68=tools/x11/xf2pcx.c +1_69=tools/x11/xkeymap.c +2=Angelo Mottola +2_0=Added the BeOS joystick, MIDI and windowed graphics drivers, added mouse wheel, display switching and close button support for BeOS, wrote the DGA2 driver and close button support for X, contributed the bfixicon utility, added triple buffering support, a BWindow-based windowed driver and a fullscreen overlay driver to the BeOS port and reorganized its gfx subsystem. And, oh, contributed the QNX and MacOS X ports too. +2_1=addons/jpgalleg/examples/ex1.c +2_2=addons/jpgalleg/examples/ex2.c +2_3=addons/jpgalleg/examples/ex3.c +2_4=addons/jpgalleg/examples/ex4.c +2_5=addons/jpgalleg/examples/ex5.c +2_6=addons/jpgalleg/include/dct.h +2_7=addons/jpgalleg/include/internal.h +2_8=addons/jpgalleg/include/jpgalleg.h +2_9=addons/jpgalleg/misc/test.c +2_10=addons/jpgalleg/plugin/datjpeg.c +2_11=addons/jpgalleg/src/decode.c +2_12=addons/jpgalleg/src/encode.c +2_13=addons/jpgalleg/src/error.c +2_14=addons/jpgalleg/src/i386/color.s +2_15=addons/jpgalleg/src/i386/dct.s +2_16=addons/jpgalleg/src/init.c +2_17=addons/jpgalleg/src/io.c +2_18=addons/jpgalleg/src/jpgalleg.c +2_19=include/allegro/platform/aintosx.h +2_20=include/allegro/platform/aintqnx.h +2_21=include/allegro/platform/alosx.h +2_22=include/allegro/platform/alosxcfg.h +2_23=include/allegro/platform/alqnx.h +2_24=include/allegro/platform/alqnxcfg.h +2_25=include/osxalleg.h +2_26=src/beos/baccel.cpp +2_27=src/beos/bdispsw.cpp +2_28=src/beos/bdwindow.cpp +2_29=src/beos/bjoy.c +2_30=src/beos/bjoyapi.cpp +2_31=src/beos/bkeyapi.cpp +2_32=src/beos/bmidi.c +2_33=src/beos/bmidiapi.cpp +2_34=src/beos/bmousapi.cpp +2_35=src/beos/boverlay.cpp +2_36=src/beos/bsndapi.cpp +2_37=src/beos/bswitch.s +2_38=src/beos/bsysapi.cpp +2_39=src/beos/bwindow.cpp +2_40=src/gui.c +2_41=src/misc/ccolconv.c +2_42=src/qnx/qdrivers.c +2_43=src/qnx/qkeydrv.c +2_44=src/qnx/qmouse.c +2_45=src/qnx/qphfull.c +2_46=src/qnx/qphoton.c +2_47=src/qnx/qphwin.c +2_48=src/qnx/qswitch.s +2_49=src/qnx/qsystem.c +2_50=src/x/xdga2.c +2_51=src/x/xdga2s.s +2_52=tools/beos/bfixicon.cpp +2_53=tools/macosx/fixbundle.c +3=Peter Wang +3_0=Added the mouse_z wheel input support to the Linux code, fixed problems with the ESD sound driver, wrote the ALSA sound driver, wrote the BeOS sound driver, added OSS MIDI and sample input support, added banked mode support to the SVGAlib driver, wrote the X DGA mode switching code, improved the Linux joystick driver, X11 fullscreen, DGA2 and DGA driver, added pthread timers under Linux/Unix and did loads of other things too. +3_1=addons/loadpng/examples/browse.c +3_2=addons/loadpng/examples/exalpha.c +3_3=addons/loadpng/examples/example.c +3_4=addons/loadpng/examples/exdata.c +3_5=addons/loadpng/loadpng.c +3_6=addons/loadpng/regpng.c +3_7=addons/loadpng/savepng.c +3_8=examples/expackf.c +3_9=examples/exsyscur.c +3_10=include/allegro/platform/astdint.h +3_11=src/beos/bdwindow.cpp +3_12=src/beos/bmousapi.cpp +3_13=src/beos/bsndapi.cpp +3_14=src/drvlist.c +3_15=src/file.c +3_16=src/fsel.c +3_17=src/linux/ljoy.c +3_18=src/linux/svgalib.c +3_19=src/linux/svgalibs.s +3_20=src/misc/fm_emu.h +3_21=src/misc/modexsms.c +3_22=src/tga.c +3_23=src/unix/alsa5.c +3_24=src/unix/arts.c +3_25=src/unix/udrvlist.c +3_26=src/unix/uesd.c +3_27=src/unix/umodules.c +3_28=src/unix/uoss.c +3_29=src/unix/uossmidi.c +3_30=src/unix/uptimer.c +3_31=src/unix/usigalrm.c +3_32=src/unix/uthreads.c +3_33=src/unix/utimer.c +3_34=src/win/wkeybd.c +3_35=src/x/xwin.c +3_36=tools/x11/xf2pcx.c +4=Eric Botcazou +4_0=Made the DGA driver work better in 8bpp and 32bpp modes, improved the DirectX windowed driver and Windows graphics subsystem, partially revamped the Unicode API and added uszprintf(), added file_select_ex(), the unified al_find*() interface, an Unicode example, a new filetest, rewrote the fixdll script, revamped the Borland C++ build process, fixed lots of bugs and did plenty of other things too. +4_1=examples/exunicod.c +4_2=setup/setup.c +4_3=src/beos/bsysapi.cpp +4_4=src/fsel.c +4_5=src/gui.c +4_6=src/misc/ccolconv.c +4_7=src/misc/colconv.c +4_8=src/misc/icolconv.s +4_9=src/qnx/qphaccel.c +4_10=src/qnx/qphbmp.c +4_11=src/qnx/qphwin.c +4_12=src/qnx/qswitch.s +4_13=src/tga.c +4_14=src/timer.c +4_15=src/unicode.c +4_16=src/unix/uthreads.c +4_17=src/win/asmlock.s +4_18=src/win/wddbmp.c +4_19=src/win/wddmode.c +4_20=src/win/wddwin.c +4_21=src/win/wdsound.c +4_22=src/win/wgdi.c +4_23=src/win/winput.c +4_24=src/win/wjoydx.c +4_25=src/win/wjoyhelp.c +4_26=src/win/wthread.c +4_27=src/win/wtimer.c +4_28=tests/filetest.c +4_29=tests/win/dibsound.c +4_30=tests/win/dxwindow.c +4_31=tools/plugins/datfname.c +5=George Foot +5_0=Did a great deal of work on the Linux console version, wrote the AWE32 driver, added the MIDI pause/seek functions, provided the basis of the SoundFont reader used in the pat2dat utility, fixed the C fceil() function, added the ffloor() function and added non-FM support to the OSS MIDI driver. +5_1=include/allegro/platform/aintlnx.h +5_2=src/dispsw.c +5_3=src/dos/awedata.c +5_4=src/dos/emu8k.c +5_5=src/dos/emu8k.h +5_6=src/dos/emu8kmid.c +5_7=src/linux/fbcon.c +5_8=src/linux/lasyncio.c +5_9=src/linux/lconsole.c +5_10=src/linux/lgfxdrv.c +5_11=src/linux/ljoy.c +5_12=src/linux/lkeybd.c +5_13=src/linux/lmemory.c +5_14=src/linux/lmouse.c +5_15=src/linux/lmsedrv.c +5_16=src/linux/lmsegpmd.c +5_17=src/linux/lmsems.c +5_18=src/linux/lmseps2.c +5_19=src/linux/lstddrv.c +5_20=src/linux/lsystem.c +5_21=src/linux/ltimer.c +5_22=src/linux/lvga.c +5_23=src/linux/lvgahelp.c +5_24=src/linux/vtswitch.c +5_25=src/midi.c +5_26=src/unix/usigalrm.c +5_27=src/unix/uthreads.c +5_28=tools/pat2dat.c +6=Jason Wilkins +6_0=Wrote the quaternion math routines and contributed the BeOS port. +6_1=examples/exquat.c +6_2=include/allegro/platform/aintbeos.h +6_3=include/allegro/platform/albecfg.h +6_4=include/allegro/platform/albeos.h +6_5=include/bealleg.h +6_6=src/beos/baccel.cpp +6_7=src/beos/bgfx.c +6_8=src/beos/bgfxapi.cpp +6_9=src/beos/bgfxdrv.c +6_10=src/beos/bjoydrv.c +6_11=src/beos/bkey.c +6_12=src/beos/bkeyapi.cpp +6_13=src/beos/bkeydrv.c +6_14=src/beos/bmididrv.c +6_15=src/beos/bmousapi.cpp +6_16=src/beos/bmousdrv.c +6_17=src/beos/bmouse.c +6_18=src/beos/bsnd.c +6_19=src/beos/bsnddrv.c +6_20=src/beos/bswitch.s +6_21=src/beos/bsysapi.cpp +6_22=src/beos/bsysdrv.c +6_23=src/beos/bsystem.c +6_24=src/beos/btimeapi.cpp +6_25=src/beos/btimedrv.c +6_26=src/beos/btimer.c +6_27=src/beos/bwscreen.cpp +6_28=src/quat.c +7=Stefan Schimanski +7_0=Wrote the original Windows version pretty much single-handedly. +7_1=include/allegro/platform/aintwin.h +7_2=include/allegro/platform/al386vc.h +7_3=src/dispsw.c +7_4=src/i386/iblit8.s +7_5=src/win/wddaccel.c +7_6=src/win/wddbmp.c +7_7=src/win/wddbmpl.c +7_8=src/win/wddfull.c +7_9=src/win/wddlock.c +7_10=src/win/wddmode.c +7_11=src/win/wddovl.c +7_12=src/win/wddraw.c +7_13=src/win/wddraw.h +7_14=src/win/wdispsw.c +7_15=src/win/wdsndmix.c +7_16=src/win/wdsound.c +7_17=src/win/wdxver.c +7_18=src/win/wgdi.c +7_19=src/win/wjoyhelp.c +7_20=src/win/wjoyw32.c +7_21=src/win/wkeybd.c +7_22=src/win/wmidi.c +7_23=src/win/wmouse.c +7_24=src/win/wsystem.c +7_25=src/win/wthread.c +7_26=src/win/wtimer.c +7_27=src/win/wwnd.c +8=Elias Pschernig +8_0=Added a COLORCONV_KEEP_TRANS mode, contributed the wfixicon utility, contributed several enhancements to the grabber, fixed menu dimensions in the GUI engine, fixed the get_camera_matrix*() functions, added support for the CHM and Devhelp documentation formats, fixed a bug in midi_seek(), made load_datafile_object() load the object properties, made the GUI code scare the mouse more intelligently and did plenty of other things too. +8_1=demos/skater/source/skater.c +8_2=docs/src/makedoc/makechm.c +8_3=docs/src/makedoc/makedevh.c +8_4=examples/exgui.c +8_5=examples/expackf.c +8_6=src/blit.c +8_7=src/datafile.c +8_8=src/font.c +8_9=src/gui.c +8_10=src/midi.c +8_11=src/unix/alsa9.c +8_12=src/unix/jack.c +8_13=src/unix/utimer.c +8_14=src/win/wkeybd.c +8_15=src/x/xkeyboard.c +8_16=tools/win/wfixicon.c +8_17=tools/x11/xf2pcx.c +8_18=tools/x11/xkeymap.c +9=Bertrand Coconnier +9_0=Modified 3D polygones routines for subpixel and subtexel accuracy, made speed enhancements in these routines, fixed blending in C version of atex_lit scanline functions, added scanline subdivisions in C scanline functions and Z-buffer polygon functions and merged in Calin Andrian's P3D library. +9_1=examples/exscn3d.c +9_2=examples/exzbuf.c +9_3=src/c/cscan.h +9_4=src/c/czscan.h +9_5=src/c/czscan15.c +9_6=src/c/czscan16.c +9_7=src/c/czscan24.c +9_8=src/c/czscan32.c +9_9=src/c/czscan8.c +9_10=src/i386/izbuf.s +9_11=src/poly3d.c +9_12=src/scene3d.c +10=Ronaldo Hideki Yamada +10_0=Contributed the MacOS 9 port of Allegro. +10_1=include/allegro/platform/aintmac.h +10_2=include/allegro/platform/almac.h +10_3=include/allegro/platform/almaccfg.h +10_4=include/macalleg.h +10_5=src/mac/mdraw.c +10_6=src/mac/mdrv.c +10_7=src/mac/mfile.c +10_8=src/mac/msbmp.c +10_9=src/mac/msnd.c +10_10=src/mac/msys.c +11=Evert Glebbeek +11_0=Put set_gfx_mode on a diet, added a config entry for specifying the card to be used for GFX_AUTODETECT_WINDOWED, added a '-fullscreen' switch to the grabber, cleaned up the grabber/plugins code, added various commands to the grabber, added the detection of SunOS/Solaris, added configure options for x86 processor optimisations on Unix systems, added the support for relative filenames and did plenty of other things too. +11_1=examples/exfont.c +11_2=examples/exsyscur.c +11_3=include/allegro/font.h +11_4=src/amd64/acpus.s +11_5=src/file.c +11_6=src/fontdat.c +11_7=src/readfont.c +11_8=src/x/xwin.c +11_9=tools/plugins/datfname.c +12=Grzegorz Adam Hankiewicz +12_0=Wrote several of the example programs, suggested the "compress" makefile target, translated the docs and system error messages into Spanish, suggested the idea of embedding the setup utility into other programs, wrote some documentation and corrected the .texi generation to improve texi2dvi output, improved the makedoc utility and contributed a new doc format, added reload_config_texts() and did plenty of other things too. +12_1=docs/src/makedoc/makechm.c +12_2=docs/src/makedoc/makedoc.c +12_3=docs/src/makedoc/makehtml.c +12_4=docs/src/makedoc/makemisc.c +12_5=docs/src/makedoc/maketexi.c +12_6=examples/excolmap.c +12_7=examples/exexedat.c +12_8=examples/exjoy.c +12_9=src/linux/fbcon.c +13=Calin Andrian +13_0=Wrote the truecolor, MMX, 3DNow!, masked lit mode, translucent and Z-buffered polygon rendering routines, the clip3d_f() function and also the scanline sorting functions for 3D scene rendering, and his P3D addon library was merged in. +13_1=src/clip3df.c +13_2=src/i386/icpu.c +13_3=src/i386/icpus.s +13_4=src/i386/iscan.s +13_5=src/i386/iscanmmx.s +13_6=src/i386/izbuf.s +13_7=src/poly3d.c +13_8=src/scene3d.c +14=Marek Habersack +14_0=Did the original Linux console port (brave man: this was the first ever work done on porting Allegro away from DOS), which is the basis of the code we are still using today and added support for the more recent Trident chipsets (now available as part of the FreeBE/AF project). +14_1=src/linux/lasyncio.c +14_2=src/linux/lconsole.c +14_3=src/linux/lkeybd.c +14_4=src/linux/lmemory.c +14_5=src/linux/lstddrv.c +14_6=src/linux/lvga.c +14_7=src/linux/lvgahelp.c +14_8=src/linux/vtswitch.c +15=Isaac Cruz +15_0=Fixed a bug with accelerated drawing onto sub bitmaps of DirectDraw surfaces, added the GFX_DIRECTX_WIN driver, fixed a Windows sub bitmap locking bug, added Windows desktop_color_depth and yield_timeslice routines, and made extensive modifications to other aspects of the Windows code. +15_1=src/misc/ccolconv.c +15_2=src/misc/colconv.c +15_3=src/misc/icolconv.s +15_4=src/win/asmlock.s +15_5=src/win/wddaccel.c +15_6=src/win/wddwin.c +16=Miran Amon +16_0=Fixed an undocumented arbitrary limit in get_config_argv() and contributed to the skater demo. +16_1=demos/skater/include/fps.h +16_2=demos/skater/include/scrshot.h +16_3=demos/skater/source/fps.c +16_4=demos/skater/source/menuabt.c +16_5=demos/skater/source/scrshot.c +16_6=demos/skater/source/skater.c +17=Sven Sandberg +17_0=Fixed a problem with save_bitmap() rounding the image widths, optimised the create_light_table() function, optimised the fixed point trigonometric routines, provided the Swedish message translations, improved the file selector sorting algorithm, optimised the spline routines, added ustrrchr(), improved the usprintf() handling of floats, changed the Z-buffer API, and did plenty of other things too. +17_1=src/color.c +17_2=src/gui.c +17_3=src/rotate.c +17_4=src/rsfb.c +17_5=src/spline.c +17_6=src/unicode.c +18=Henrik Stokseth +18_0=Contributed a native Mingw32 port which can also be built with a cross-compiler and the Cygwin compiler, much improved OS detection, added get_gfx_mode_list() and methods for querying the VGA, Mode-X, Xtended, VESA, VBE/AF and DirectX drivers for a list of possible GFX modes, rewrote the mode-selector to use get_gfx_mode_list(), reworked the build system many times and did plenty of other things too. +18_1=include/allegro/platform/almngw32.h +18_2=src/libc.c +18_3=src/modesel.c +18_4=src/win/wddmode.c +18_5=tests/cpptest.cpp +19=Javier Gonzalez +19_0=Corrected mouse movement speed, made allegro_message() use title from set_window_title(), added close button hook support and improved switching in Windows, fixed bad clearing of subbitmaps, made bug reports and suggestions for improvement, contributed bidirectional looping support, backward playing support and bugfixes for the DirectSound driver and did plenty of other things too. +19_1=src/win/wdsinput.c +19_2=src/win/wdsndmix.c +19_3=src/win/wdsound.c +19_4=src/win/wsystem.c +19_5=tests/win/dibsound.c +20=Michal Mertl +20_0=Wrote all the 24 bit graphics code, the optimised palette generation function and a fair amount of the other truecolor stuff too (bitmap scaling, image loading, etc). +20_1=src/i386/iblit24.s +20_2=src/i386/igfx24.s +20_3=src/i386/ispr24.s +20_4=src/quantize.c +20_5=src/tga.c +21=Annie Testes +21_0=Added font_height, render_char, char_length hooks to FONT_VTABLE, fixed several glitches in the unicode support, added a pack_fdopen() function, caught a misordering in the X system shutdown, fixed some device name strings, lifted several hardcoded length limitations in the configuration routines, added a mouse driver based on the event interface (EVDEV) to the Linux port, fixed numerous bugs and did plenty of other things too. +21_1=src/config.c +21_2=src/file.c +21_3=src/fsel.c +21_4=src/linux/lmseev.c +22=Mark Wodrich +22_0=The brain behind sub-bitmaps, flicker-free mouse pointers, and the ability to import GRX .FNT files into the grabber. +22_1=src/dos/dmouse.c +22_2=src/fontgrx.c +22_3=src/mouse.c +22_4=tools/plugins/datfont.c +23=Ove Kaaven +23_0=Fixed a bug in the ATI mach64 driver (now available as part of the FreeBE/AF project), added native truecolor and linear framebuffer support to the ATI driver, contributed the Norwegian keyboard mapping, and added MIDI and sample input features to the MPU and SB drivers respectively. +23_1=src/dos/mpu.c +23_2=src/dos/pic.c +23_3=src/dos/sb.c +23_4=src/sound.c +24=Peter Pavlovic +24_0=Added the Slovak keyboard mapping and message translation, stopped the DOS file selector from listing virtual drives, did the same for the Windows file selector, improved the support for accented character maps in the keyboard driver and made aesthetic modifications to the GUI menu system. +24_1=setup/keyconf.c +24_2=src/fsel.c +24_3=src/gui.c +24_4=src/misc/pckeys.c +25=Robert J. Ohannessian +25_0=Added MMX optimisation for the 8 and 16-bit clear() functions, fixed bad clearing of subbitmaps, added SSE detection and optimised some masked blits with SSE instructions, added some routines to the unified color convertor and made some of them more robust, fixed the docs for pivot_scaled_sprite_v_flip(), revamped the retrieval mechanism of CPU capabilities, separated the CSS file and did plenty of other things too. +25_1=docs/src/makedoc/makehtml.c +25_2=src/misc/ccolconv.c +25_3=src/misc/colconv.c +25_4=src/misc/icolconv.s +26=Salvador Eduardo Tropea +26_0=Improved the keyboard routines (better handling of extended scancodes, keyboard LED support, capslock and numlock, and alt+numpad input), contributed the 320x100 VGA graphics mode, added support for proper 16 bit sample mixing, fixed compilation on gcc 3.x and made numerous other useful suggestions, contributions and bugfixes. +26_1=src/misc/pckeys.c +26_2=src/misc/vga.c +26_3=src/mixer.c +26_4=src/tga.c +27=Thomas Harte +27_0=Helped fix a bug in show_video_bitmap() on MacOS X, helped optimise fixmul(), helped find many bugs in the MacOS X port, like better support for user-supplied Nibs, implemented a hardware accelerated stretch_blit under DirectX, fixed a bug with draw_sprite and sub-bitmaps and contributed to the skater demo. +27_1=demos/skater/include/token.h +27_2=demos/skater/source/menuabt.c +27_3=demos/skater/source/skater.c +27_4=src/win/wddaccel.c +28=Chris Robinson +28_0=Wrote the fixed point clip3d() function, improved the performance of the DIGMID driver, implemented the digmid_set_pan function, rewrote part of the Allegro mixer, made the Allegro mixer the default one in Windows, improved the threaded UNIX timer code, helped improve responsiveness under X11, tweaked tests/play.c, added drawing primitives and video bitmap locking to the X11 port and did plenty of other things too. +28_1=src/clip3d.c +28_2=src/digmid.c +28_3=src/mixer.c +29=Fabian Nunez +29_0=Added support for the CH Flightstick Pro and Logitech Wingman Extreme joysticks, 3-button mice, and the extended keys on a Microsoft keyboard. +29_1=src/dos/dmouse.c +29_2=src/dos/joystd.c +29_3=src/misc/pckeys.c +30=Jonathan Tarbox +30_0=Wrote the mode-X setup code, the FLI/FLC player and contributed parts of the joystick handler. +30_1=src/dos/joystd.c +30_2=src/fli.c +30_3=src/misc/modex.c +31=Joshua Heyer +31_0=Wrote the original version of the OSS sound driver. +31_1=src/unix/uoss.c +31_2=src/win/wdsndmix.c +31_3=src/win/wsndwo.c +32=Marcel de Kogel +32_0=Not content with fixing my broken MPU-401 driver, Marcel went on to provide a set of vastly improved drum sounds for the OPL driver, to help me sort out some problems with reentrant interrupts, to supply the half of the joystick code that didn't come from Jonathan and to locate a stupid mistake in my VESA linear framebuffer code. +32_1=src/dos/djirqs.s +32_2=src/dos/joystd.c +32_3=src/dos/mpu.c +33=Patrick Hogan +33_0=Wrote the draw_gouraud_sprite() function, and made Windows audiostreams work properly. +33_1=examples/exshade.c +33_2=src/gsprite.c +33_3=src/win/wdsound.c +34=Peter Cech +34_0=Added grabber support for the 8x8 BIOS font format, support for hot-swapping between a custom keyboard layout and the standard US mapping, optimised the alpha sprite blending routines and added non-ASCII space recognition to uisspace(). +34_1=src/colblend.c +34_2=src/misc/pckeys.c +34_3=src/unicode.c +35=Robin Burrows +35_0=Provided a new page flipping code for the DirectDraw subsytem, added a Windows sound driver using the Allegro mixer and another using waveOut, fixed two glitches in the DirectDraw code. +35_1=src/win/wddbmp.c +35_2=src/win/wdsndmix.c +35_3=src/win/wsndwo.c +36=Seymour Shlien +36_0=Contributed the Windows BMP file reader, bezier spline drawer, and justified text plotting function. +36_1=src/bmp.c +36_2=src/spline.c +36_3=src/text.c +37=Vincent Penquerc'h +37_0=Added the D_DIRTY flag and mouse button press/release events to the GUI system, optimised the 256 to truecolor blitting code to avoid repeated conversions of the palette table, added scare_mouse_area(), added the yield_timeslice() function, added the update selection function to the grabber, added the XCRP and YCRP properties to datafiles in general, implemented the big header split and did plenty of other things too. +37_1=include/allegro.h +37_2=src/modesel.c +37_3=src/readsmp.c +38=Acho A. Tang +38_0=Added a Sidewinder Precision Pro joystick driver to the DOS port. +38_1=src/dos/swpp.c +38_2=src/dos/swpps.s +39=Andrei Ellman +39_0=Contributed the polygon_z_normal() function, suggested some additions to the docs, updated the Cygwin section in docs/build/mingw32.txt, got Allegro for MSVC to build with Cygwin, improved the performance of the hsv_to_rgb() function, corrected a rounding issue in hsv_to_rgb(), improved the exrgbhsv example and the Windows screensaver, fixed problems in the MSVC makefile when using Cygwin and did plenty of other things too. +39_1=examples/exrgbhsv.c +39_2=tests/win/scrsave.c +40=Andrew Geers +40_0=Added the -ppassword and -nosound options to the grabber, scrolling support in the image viewer and the flipped rotated sprite routines. +40_1=src/rotate.c +40_2=src/rsfb.c +41=Ben Davis +41_0=Added set_volume_per_voice(), made silent voices continue playing, fixed other minor bugs in the mixer, fixed a bug in create_rgb_table(), adapted polygon functions to handle two coincident vertices, added the set_window_close_button() and set_window_close_hook() framework, added support for timers with parameters under Windows, corrected several compilation warnings and documented the behaviour of pack_feof(). +41_1=src/mixer.c +41_2=src/poly3d.c +42=Dave Thomson +42_0=Added the RGB <-> HSV conversion routines, the autocrop function to the grabber and wrote the 3d starfield example program (exstars.exe). +42_1=examples/exstars.c +42_2=src/color.c +43=Grzegorz Ludorowski +43_0=Wrote several of the example programs, and made the intro animation and graphics for the demo game. +43_1=examples/exscale.c +43_2=examples/exsprite.c +44=Jakub Wasilewski +44_0=Fixed a bug when loading greyscale TGA images and contributed to the skater demo. +44_1=demos/skater/source/menuabt.c +44_2=demos/skater/source/skater.c +45=Jon Rafkind +45_0=Added more ASSERTs to the code, implemented the Cohen-Sutherland clipping algorithm for the line() function and supplied an m4 macro for allegro. Also fixed a problem with allegro-config. Implemented draw_sprite_ex() function. +45_1=examples/extrans2.c +45_2=src/gfx.c +46=Jose Antonio Luque +46_0=Improved the Windows joystick driver, and optimised the 16-bit blit() and masked_blit() functions. +46_1=src/i386/iblit16.s +46_2=src/win/wjoyw32.c +47=Kerry High +47_0=Contributed the SNES joypad driver. +47_1=src/dos/ifsega.c +47_2=src/dos/snespad.c +48=Laurence Withers +48_0=Added destroy hook to font structure, worked on const-correctness throughout the library, implemented the new FONT structure, made some modules avoid linking dependencies, contributed the dat2c utility, added two fixed point ratios for converting to and from radians, added a '-windowed' switch to the grabber, added a new text API and did plenty of other things too. +48_1=src/text.c +48_2=tools/dat2c.c +49=Lorenzo Petrone +49_0=Contributed the gfxinfo utility, added two FAQ entries, added a xwin_set_window_name() function to the X11 port, added support for switch callbacks under X11 and refactored the display switching code. +49_1=src/dispsw.c +49_2=tests/gfxinfo.c +50=Marian Dvorsky +50_0=Wrote the Windows GDI interface routines. +50_1=src/win/gdi.c +50_2=tests/win/dibhello.c +51=Richard Davies +51_0=Added support for PSX and N64 joypads. +51_1=src/dos/n64pad.c +51_2=src/dos/psxpad.c +52=Richard Mitton +52_0=Added support for 6-button joysticks, and wrote the 12-bit color example program (ex12bit.c). +52_1=examples/ex12bit.c +52_2=src/dos/joystd.c +53=Robert J. Ragno +53_0=Wrote the Gravis GrIP driver, made some improvements to the Wingman, PSX and throttle input code. +53_1=src/dos/gripfnc.s +53_2=src/dos/gripjoy.c +54=Thomas Fjellstrom +54_0=Wrote the ALSA 0.5.x MIDI driver and added support for ALSA 0.9.x. +54_1=src/unix/alsa9.c +54_2=src/unix/alsamidi.c +55=Adrian Oboroc +55_0=Wrote the LBM loader. +55_1=src/lbm.c +56=Andreas Kluge +56_0=Wrote the Ensoniq Soundscape driver and fixed division bugs in the fix class. +56_1=src/dos/sndscape.c +57=Andrew Ellem +57_0=Wrote the original version of the digital audio streaming code. +57_1=src/stream.c +58=Andy Goth +58_0=Made the gfx_card config variable more flexible, added the 256x256 tweaked VGA mode, wrote the d_text_list_proc() dialog object and fixed the constructor support in dat2s on Unix. +58_1=src/guiproc.c +59=Antti Koskipaa +59_0=Wrote the DOS driver for WSS (Windows Sound System) cards. +59_1=src/dos/wss.c +60=Attila Szilagyi +60_0=Fixed SVGAlib horizontal scrolling. +60_1=src/linux/svgalib.c +61=Bobby Ferris +61_0=Added the SciTE API output format to makedoc and temporarily hosted Allegro's SVN repository while SourceForge's SVN was in beta. +61_1=docs/src/makedoc/makesci.c +62=Burton Radons +62_0=Optimised the truecolor pixel blending function, converted the blenders to the new single-handler format, and added the range of Photoshop-compatible blender functions. +62_1=src/colblend.c +63=Carsten Sorensen +63_0=Wrote the the ESS AudioDrive soundcard driver. +63_1=src/dos/essaudio.c +64=Chris La Mantia +64_0=Wrote the d_radio_proc(), d_icon_proc(), and d_slider_proc() dialog objects, added the D_DISABLED flag, improved the GUI handling of different font heights, and added the right aligned text functions. +64_1=src/guiproc.c +65=Christer Sandberg +65_0=Made dat2c work better with ISO C90 compilers, made dat2c correctly detect the native line ending, fixed a problem with the include guard generated by dat2c, fixed a bug in the 24-bit graphics code of fixup_datafile(), fixed a memory leak with datedit_exit, fixed a problem with Electric Fence. +65_1=tools/dat2c.c +66=Cloud Wu +66_0=Optimised the truecolor pixel blending functions. +66_1=src/colblend.c +67=Daniel Verkamp +67_0=Added a MIDI input driver to the Windows port and added support for .rmi MIDI files to the MIDI loader. +67_1=src/win/wmidi.c +68=David Kuhling +68_0=Optimised the fsqrt() routine, and added fhypot(). +68_1=src/i386/imisc.s +69=Dominique Biesmans +69_0=Wrote the mode-X version of draw_sprite() and the mode-X <-> linear blitting functions. +69_1=src/misc/modexgfx.s +70=Doug Eleveld +70_0=Wrote the d_textbox_proc() dialog object and the new grabber help system. +70_1=src/guiproc.c +71=Eduard Bloch +71_0=Fixed a freeze caused by the ESD detection code, fixed a bad behaviour of the config routines and suggested better ways to find the path to the executable on Unix. +71_1=src/unix/uesd.c +72=Erik Sandberg +72_0=Optimised the 8 bit draw_sprite() and draw_trans_sprite() functions and helped with the Swedish message translation. +72_1=src/i386/ispr8.s +73=Ettore Perazzoli +73_0=Optimised the linear -> mode-X blitting function. +73_1=src/misc/modexgfx.s +74=Fabrizio Gennari +74_0=Contributed the DB9 and TurboGraFXoystick drivers. +74_1=src/dos/multijoy.c +75=Francisco Pires +75_0=Added an FPS counter and an option to disable vsync to the excamera example. +75_1=examples/excamera.c +76=Greg Hackmann +76_0=Contributed the Borland C++ Builder port. +76_1=include/allegro/platform/albcc32.h +77=Guilherme Silveira +77_0=Modified the file selector to only list valid drive letters. +77_1=src/fsel.c +78=Haruhiko Okumura +78_0=Wrote the original version of the LZSS compression code. 12-2-404 Green Heights, 580 Nagasawa, Yokosuka 239, JP. +78_1=src/lzss.c +79=Ivan Baldo +79_0=Wrote the 15/16 bit dithering code and optimised the sprite rotation routines. +79_1=src/dither.c +80=James Hyman +80_0=Added support for quoted strings in the get_config_argv() function and the dithering code for paletted images. +80_1=src/blit.c +81=Jan Hubicka +81_0=Vastly improved the speed of the create_rgb_table() function. +81_1=src/color.c +82=Johan Peitz +82_0=Fixed and enhanced the Win32 joystick driver, and contributed the 'Alex the Allegator' icon. +82_1=src/win/wjoyw32.c +83=Jonas Petersen +83_0=Added the save_bmp() function and support for the OS/2 BMP format. +83_1=src/bmp.c +84=Jorrit Rouwe +84_0=Provided a new and much cooler set of FM instrument definitions for the Adlib MIDI driver. +84_1=src/misc/fm_drum.h +85=Kester Maddock +85_0=Wrote the Wingman Warrior joystick driver. +85_1=src/dos/ww.c +86=Lennart Steinke +86_0=Added the exconfig example, contributed keyboard layout detection code for Windows and suggested the true colour font rendering. +86_1=examples/exconfig.c +87=Lisa Parratt +87_0=Contributed the SGI Audio Library sound driver, spotted a BSDism that IRIX doesn't like at all, added IRIX detection and improved the performances of the SGI audio driver +87_1=src/unix/sgial.c +88=Magnus Henoch +88_0=Made the gfx mode selector keep the current selection as much as possible and fixed a problem when compiling without 8bpp support. +88_1=src/modesel.c +89=Marius Fodor +89_0=Added support for the Sidewinder and Gravis GamePad Pro. +89_1=src/dos/gpro.c +90=Martijn Versteegh +90_0=Added the config hook extension mechanism. +90_1=src/config.c +91=Mathieu Lafon +91_0=Added the French keyboard mapping, support for the Pause/PrtScr keys and changed the key[] table to a normal/extended bitfield. +91_1=src/misc/pckeys.c +92=Matthew Bowie +92_0=Added support for 4-button joysticks. +92_1=src/dos/joystd.c +93=Matthew Leverton +93_0=Fixed a bug with mouse mickeys in windowed mode under Windows, fixed a problem with al_find*() and NTFS partitions under Windows, added missing header files to be installed by the Windows binary distribution, made the DOS/Windows makefiles use 'copy /B' instead of 'copy', added the detection of left-hand mouse configuration under Windows, fixed a bug with pack_fgets(), made an online diff generator and did lots of other things too. +93_1=include/allegro/platform/aldmc.h +94=Michael Bevin +94_0=Optimised the create_trans_table() function. +94_1=src/color.c +95=Michael Rickmann +95_0=Ported the Windows code to Mingw32. +95_1=include/allegro/platform/almngw32.h +96=Nathan Smith +96_0=Implemented the recursive handling of directories for the dat utility. +96_1=tools/dat.c +97=Neil Townsend +97_0=Improved the accuracy of the timer routines and added the callback parameters. +97_1=src/dos/dtimer.c +98=Nick Kochakian +98_0=Wrote the DirectSound input driver. +98_1=src/win/wdsinput.c +99=Ole Laursen +99_0=Contributed the Danish keyboard mapping table and system message translation, and made the Unicode utolower() and utoupper() functions understand the entire 16 bit character set. +99_1=src/unicode.c +100=Omar Cornut +100_0=Spotted an asm locking bug under Windows, bumped the maximum number of buttons per joystick to 32, fixed the Windows joystick driver to handle a weird peculiarity of the DirectInput API and improved the handling of KEY_COLON2 on Japanese keyboards. +100_1=src/win/wjoydx.c +101=Owen Embury +101_0=Wrote part of the translucency/lighting code. +101_1=examples/extrans.c +102=Paul Hampson +102_0=Improved and fixed some problems in the SNES gamepad driver. +102_1=src/dos/snespad.c +103=Pedro Cardoso +103_0=Contributed the tweaked 80x80 VGA mode. +103_1=src/misc/vga.c +104=Przemek Podsiadly +104_0=Added hicolor versions of the 3d polygon code. +104_1=src/poly3d.c +105=Romano Signorelli +105_0=Added an arc plotting routine. +105_1=src/gfx.c +106=S.Sakamaki +106_0=Added the VESA 3.0 refresh rate control code. +106_1=src/dos/sw.c +107=Sam Hocevar +107_0=Fixed a Bashism in fix.sh that makes Solaris' sh choke, a race condition in the mixer under Unix w/ threads, Windows, BeOS and MacOS X, a crash in makedoc, made it possible to put functions from .s sources in a shared library under Unix and removed deprecated use of several functions. +107_1=src/mixer.c +108=Stefan Eilert +108_0=Added support for a second joystick. +108_1=src/dos/joystd.c +109=Stefan T. Boettner +109_0=Wrote the Linux SVGAlib driver. +109_1=src/linux/svgalib.c +110=TBD/FeR +110_0=Added the 320x600 and 360x600 resolutions to the mode-X driver. +110_1=src/misc/modex.c +111=Theuzifan Sumachingun +111_0=Improved the cpu detection for Cyrix chips and made the file selector only list valid drive letters. +111_1=src/fsel.c +112=Tim Gunn +112_0=Wrote the TGA reading/writing routines. +112_1=src/tga.c +113=Tom Novelli +113_0=Wrote the original version of the digital MIDI driver. +113_1=src/digmid.c +114=Tomohiko Sugiura +114_0=Added the KEY_ABNT_C1, KEY_YEN, KEY_KANA, KEY_CONVERT, KEY_NOCONVERT and other keys to the input handler, organised getting the IF-SEGA joystick drivers by S.Suzuki merged into my codebase and added a more aggressive Sidewinder joystick driver. +114_1=src/dos/sw.c +115=VolkerOth +115_0=Integrated the concepts of scrolling and edit_proc objects. +115_1=src/guiproc.c +116=8L45T3R +116_0=Fixed a bug in arc() where small arcs would be drawn as circles. +117=Alessandro Monopoli +117_0=Added the Italian translation of the system messages. +118=Alex Demko +118_0=Suggested lots of improvements to the datafile system and provided code for handling the 8x16 BIOS font format. +119=Andrew Cottrell +119_0=Changed the grabber to use a more robust (locale-independent) date format. +120=Antoine Mathys +120_0=Added the Swiss keyboard mapping. +121=Anton Ragnarsson +121_0=Contributed the Swedish keyboard mapping table. +122=Antti Haapala +122_0=Fixed the setup program to display the right frequency list for each type of soundcard and contributed the Finnish translation of the system messages. +123=Arne Steinarson +123_0=The fixed point square root routine came from his fix-float library. +124=Arthur Huillet +124_0=Fixed a typo in the docs. +125=Ben Chauveau +125_0=Added support for Tseng ET6000 cards (now available as part of the FreeBE/AF project). +126=Ben Darnell +126_0=Put together the 2.11 release of Allegro while I was away from the net and wrote the original version of the Allegro FAQ. +127=Benjamin Joel Stover +127_0=Wrote the initial version of the fullscreen X-Windows graphics driver. +128=Benny Colyn +128_0=Added a Dutch translation. +129=Calvin French +129_0=Added the -w (always update) switch to dat.exe. +130=Carsten Schmidt +130_0=Wrote the the initial version of the Linux GGI driver. +131=Catatonic Porpoise +131_0=Added OpenBSD detection, fixed an issue with executable rights not set on the memory for the i386 stretcher on UNIX systems, and fixed the documentation for stretch_sprite. +132=Charles Bilyue +132_0=Optimized the i386 blitters and suggested to not force yielding timeslice with non-blocking menus. +133=Charles Wardlaw +133_0=Fixed warnings with gcc 4 on MacOS X and helped resolve a problem with setAppleMenu under Tiger. +134=Chris Graham +134_0=Suggested to add a new flag for Windows NTFS compressed files. +135=Chris Jones +135_0=Fixed a bug with 16-bit samples loading, worked around a problem with DOS file attributes under Win2k, let the MIDI player pass controller events to the raw player by default, made the MIDI player handle the 'All Sound Off' controller message, added support for the bitfield compressed BMP image format, fixed the behavior of numeric keys when NumLock is on, and fixed loading of certain .wav files. +136=Christian Schueler +136_0=Changed the optimisation settings for better performance. +137=Daniel Nilsson +137_0=Enlarged the starfield in exstars, and fixed an incorrect range in exlights. +138=Daniel Schlyder +138_0=Fixed problems with get_executable_name() under Windows, another one with set_window_title() under BeOS, potentially unsafe constructs in the Windows code, the installall makefile target under Windows, added set_allegro_resource_path(), fixed make uninstall with mingw make, added ALLEGRO_LIB_BUILD flag for gcc variants not using configure, fixed a bunch of warnings in MinGW and did plenty of other things too. +139=Dark Nation +139_0=Restored support for old-style encrypted packfiles, which had been removed in 4.1.18. +140=David A. Capello +140_0=Made dotted_rect() avoid bank switches, fixed a problem with lost GUI mouse clicks, made d_menu_proc() steal/return focus when activated then deactivated, fixed a problem with submenus, fixed a bug with FLI frames containing odd-sized chunks, made makedoc write sub-section headings for .txt output, made override_config_file also be used for writing to the config file and did plenty of other things too. +141=David Calvin +141_0=Wrote the original version of the sound setup utility. +142=David Cullen +142_0=Added multiple bullets and extra lives to the demo game. +143=Deepak T +143_0=Fixed clipping in three C sprite drawing routines. +144=Dennis Busch +144_0=Fixed a bug in d_clear_proc, fixed a Unicode bug in the mode selector, and fixed the short description of add_clip_rect. +145=Dmitriy Kazimirow +145_0=Provided the Russian keyboard mapping and message translation files. +146=Dustin Dettmer +146_0=Spotted a typo in save_bitmap. +147=Edward Boone +147_0=Provided scancode mapping tables for the AZERTY keyboard layout. +148=EvilTypeGuy +148_0=Cleaned up and fixed the RPM spec file for RedHat 9. +149=Francois Charton +149_0=Wrote the Paradise graphics driver (now available as part of the FreeBE/AF project), improved the VGA palette setting code and helped with the TexInfo conversion of the docs. +150=Frodo Baggins +150_0=Made the Portuguese keyboard mapping. +151=Garret Thomson +151_0=Wrote the music used in the demo game. +152=Gorka Olaizola +152_0=Added the Redhat RPM .spec file. +153=Grady Martin +153_0=Fixed a bug in the handling of %n in the printf style text functions, added a move command to the grabber and standardised some of the grabber dialog boxes. +154=Greg Lee +154_0=Pointed out that Linux joystick driver should read all events. +155=Grzegorz Godlewski +155_0=Contributed a Polish localization patch, and added support for lower and upper altgr tables. +156=Gunter Ladwig +156_0=Wrote the OS/2 detection routines and added the three-button mouse emulation. +157=Harshavardhana Reddy N +157_0=Added a Kannada greeting to exunicod. +158=Hein Zelle +158_0=Revamped the cross-compilation section of docs/build/mingw32.txt, clarified a requirement when cross-compiling from Linux, reworked the paragraph on the location of shared libraries under Unix in the docs and added a FAQ entry on the same subject. +159=Henrik Schmidt +159_0=Found a workaround for the switching problem under Windows, made gcc pass '-h' instead of '-soname' to the linker and replaced '-L' by '-h' in shell comparisons so as not to break on Solaris. +160=Hrvoje Ban +160_0=Pointed out a bug in the mode selector, fixed several double ;'s, fixed ASSERT() in Windows, helped write a documentation section about common pitfalls, and added the create_datafile_index function. +161=Igor Gnip +161_0=Removed the requirements for fileutils on DOS/Windows platforms and added the detection of MSYS to the MingW32 port. +162=J. P. Morris +162_0=Fixed a bug rest_callback under unix. +163=Jaime Moreno +163_0=Helped track down a problem with dependency generation in MacOS X. +164=James Arthur +164_0=Documented the Photoshop-style truecolor blender routines. +165=James Lohr +165_0=Fixed a problem with mouse acceleration in fullscreen modes under Windows. +166=James Ponder +166_0=Suggested to remove the DJGPP makefile from the Unix tar archive and clarified a requirement when cross-compiling from Linux. +167=Jan Bruun Andersen +167_0=Fixed a compilation problem with Cygwin. +168=Jeff Mitchell +168_0=Fixed the location of grabber.txt in the spec file. +169=Jeremiah Blanchard +169_0=Contributed modifications in order for Allegro to build on Darwin/MacOS X and updated the build instructions for this new port afterwards. +170=Jim Flynn +170_0=Removed floating point calculations from the AWE32 MIDI driver. +171=Jim Grainger +171_0=Spotted a broken link in the docs and updated it. +172=Jiri Gabriel +172_0=fixed loading of multiple ranges in a single bitmap with txt fonts and helped fix an off-by-one mistake for the last glyph in extract_font_range. +173=Joaquin Hierro Diaz +173_0=Made the mapping table for Spanish keyboards. +174=Joerg Rueppel +174_0=Added more flexible wildcard matching for object names in dat.exe and the find_datafile_object() function. +175=Johan Venter +175_0=Fixed some problems with the RSXNT and Mingw32 makefiles. +176=John Holden +176_0=Fixed a bug in load_wav(). +177=John Utz +177_0=Corrected a wrong assumption about the VRAM layout in the Linux framebuffer console driver. +178=Julien Cugniere +178_0=Improved the support for non-blocking menus, fixed a bug related to the retrieval of the inital volume when no primary buffer was present under Windows, fixed the crash on exit with the aRts sound driver, added an X11 message box for allegro_message under X11 and fixed a crash in the GUI when a dialog was opened while a menu was still open. +179=Kalle Toivonen +179_0=Fixed a bug in _parallelogram_map(). +180=Keith Gerdes +180_0=Fixed the DirectDraw overlay mode driver. +181=Knut Pape +181_0=Improved the Mingw32 readme file. +182=Kronoman X +182_0=Added a FAQ entry about the conflict between Allegro headers and the C++ 'using' directive. +183=Krzysztof Krzyzaniak +183_0=Wrote the load_voc() function. +184=Lee Killough +184_0=Added the low-level hook routine to the keyboard handler and fixed a couple of bugs. +185=Lennart Rolland +185_0=Contributed the Norwegian message translation. +186=Lucas Vignoli Reis +186_0=Added the Portuguese (Brazil) message translation and keyboard mapping. +187=Maiolino Carmelo +187_0=Added the Italian keyboard mapping table. +188=Manni Heumann +188_0=Fixed some problems with the German keyboard mapping table. +189=Marcel Smit +189_0=Corrected a bug that caused errors when drawing persp. correct polygons facing the screen, corrected an error in the packfile format write-up and made the show_video_bitmap() method of the Windows windowed driver wait for a vsync. +190=Marcio Fialho +190_0=Fixed several issues with the DJGPP port and the VBE/AF driver and fixed some bugs related to author credits. +191=Marco Campinoti +191_0=Added 15 and 24 bit support to the native Tseng ET4000 driver (now available as part of the FreeBE/AF project). +192=Marco Marmulla +192_0=Added 16 bit support to the load_voc() routine. +193=Markus F.X.J. Oberhumer +193_0=Fixed the Video-7 scrolling function (now available as part of the FreeBE/AF project), optimised the color mapping routines, and made many useful suggestions like the addition of a vid_phys_base field to the graphics driver structure. +194=Martijn Van Lersel +194_0=Fixed an overflow in create_light_table(). +195=Matt Witherspoon +195_0=Fixed a bug in the scroll() method of the Linux SVGAlib driver. +196=Maxime Carey +196_0=Contributed the Canada (French) keyboard mapping file. +197=Michael Tanczos +197_0=Fixed some bugs in the FLIC player. +198=Michail Pishchagin +198_0=Contributed the ustrnicmp() function. +199=Michal Molhanec +199_0=Simplified the build instructions for Dev-C++, replaced all occurences of MingW32 by MinGW in the docs, added an faq section about the giftware license, fixed problems with long filenames when building for MSVC, corrected a problem with the Watcom port, added MSVC7 options to the makefile, fixed a linker problem with the MSVC port, fixed some const warnings in the grabber code and did plenty of other things too. +200=Milan Mimica +200_0=Fixed bugs in the keyconf utility, the alsa 9 volume settings and extract_font_range(), helped fix an off-by-one mistake for the last glyph in extract_font_range, fixed a bug where a font would be converted to 8 bit, a bug with is_color_font, made the Linux console driver more robust, fixed some spin loops in the test program, and added the get_volume and get_hardware_volume functions, and did plenty of other things too. +201=Nathan Albury, aka Rubicant +201_0=Improved the fire routine in examples/exflame.c (my original version didn't really look very much like flames :-) and gave me some extremely useful ideas about how to implement translucency. +202=Neil Roy +202_0=Suggested many improvements to the documentation. +203=Nicholas Davies +203_0=Made the fix class not trigger warnings with gcc -Weffc++ and contributed to the skater demo. +204=Olivier Blin +204_0=Fixed compilation problems for the ModeX driver. +205=Olly Betts +205_0=Modified the djgpp makefile to support cross-compiling on a Linux machine. +206=Oscar Giner +206_0=Added the Catalan translation, corrected the Spanish translation, fixed a bug with binary data exporting in the grabber and fixed a conflict between the magic main and the MFC. +207=Owen Rudge +207_0=Contributed a DLL version resource script and the mkdata.bat script. +208=Paavo Ahola +208_0=Helped fix a problem with BCC and the C implementations of fixmul. +209=Paul Bartrum +209_0=Contributed the ellipse drawing functions. +210=Paul Furber +210_0=Provided the floating point apply_matrix_f() function. +211=Paul Pinault +211_0=Translated the system error messages into French. +212=Pavlos Touboulidis +212_0=Made file_select() able to include or exclude files based on their attributes. +213=Peter Hull +213_0=Made the file selector work with directories that have more than 2048 files, solved some compiling issues on MacOS X, fixed a bug in rest() that caused it to wait too long on that platform, fixed several problems with the hardware mouse cursor, fixed a deadlock in the software mouse updating code, fixed compilation problems under MacOS X tiger, added a MacOS X helpfile and did plenty of other things too. +214=Peter Johansson +214_0=Reported a problem with system cursors not working in Windows. +215=Peter Monks +215_0=Wrote the Video-7 graphics driver (now available as part of the FreeBE/AF project) and showed me how to set up the unchained 640x400 mode. +216=Peter Palotas +216_0=Added the keyboard callback routine. +217=Peter Puck +217_0=Helped with the Mingw32 native build. +218=Phil Frisbie, Jr. +218_0=Wrote the CPU type detection code. +219=Phil Shenk +219_0=Improved the MSVC build instructions. +220=Philipp Thomas +220_0=Fixed all comparisons between signed and unsigned types, fixed compilation on x86-64, fixed all function prototypes, converted the configure machinery to autoconf 2.53 or later and added multi-arch support, DESTDIR support and the German translation to the RPM spec file. +221=Revin Guillen +221_0=Added the position_dialog() function. +222=Richard Reeve +222_0=Fixed a silly mistake with gcc 3.0.x detection. +223=Roberto Alfonso +223_0=Fixed a couple of memory problems in the dat2c utility, added an srand() call in the demo game, made the MSVC port call `link /lib' rather than `lib', fixed several warnings with GCC 4 under DJGPP and fixed a grabber crash when importing a font range in an existing font. +224=S.Suzuki +224_0=Wrote the IF-SEGA /PCI, /PCI2, and /ISA joystick interface drivers. +225=Santeri Saarimaa +225_0=Made the Finnish keyboard mapping. +226=Sask Allegro +226_0=Added support for more than two joysticks in the Windows port. +227=Scott Harrison +227_0=Added the OpenDOS detection code. +228=Sean Gugler +228_0=Added the set_leds() function. +229=Serge Semashko +229_0=Fixed a bug with the letter P in the Russian keyboard configuration file, added Enter as a fire key to the demo game, fixed some problems with Allegro working on Nokia 770, and fixed a crash in _linear_draw_trans_rgba_rle_sprite24. +230=Seunghwan Ji +230_0=Made makedoc output correct html and rtf files for Korean. +231=Shawn Walker +231_0=Several fixes to the .spec file, made get_executable_name use getexecname() under Solaris, fixed a bug in the keyboard driver that caused crashes on the same system, worked around errors with some versions of GNU AS and fixed errors in the configure script when not using GCC +232=StApostol +232_0=Fixed a bug in the exflame example and updated the FAQ to use rest(0) instead of yield_timeslice(). +233=Stepan Roh +233_0=Added a Czech keyboard mapping and system message translation, the Latin Extended-A characters in the default font, the codepage support in the textconv utility, fixed some problems with the ESD sound driver, helped make Allegro build better on some Unix platforms, fixed const related problems in C versions of routines and added support for a automake-style DESTDIR variable in the Unix makefile. +234=Stephan Brauss +234_0=Made a few fixes to let the Linux port compile again on Linux 2.2.x, corrected a few nits in the Swiss keyboard configuration file and added new keysyms to the X11-to-BIOS conversion table in order to catch missing keycodes for the keypad when NumLock is on. +235=Stephen Kittelson +235_0=Made bugfixes and tweaks to the keyboard system. +236=Teijo Hakala +236_0=Added wheel support to the Windows mouse driver. +237=Tero Parvinen +237_0=Designed most of the new sound API. +238=Thomas Klausner +238_0=Added NetBSD detection and fixed a problem with the allegro.m4 macro and automake 1.8+. +239=Thomas Wolf +239_0=Corrected some errors in the German keyboard mapping and added the German translation of the system messages. +240=Tim Bird +240_0=Worked on the Linux console port. +241=Timothy Terriberry +241_0=Fixed several bugs in the RGB <-> HSV conversion routines. +242=Tobi Vollebregt +242_0=Spotted a bug in ustrerror(), which was not returning a pointer to a static buffer, reported a problem with shutdown_dialog() when a menu was open, helped port the Windows keyboard driver to Windows 98 and fixed a bug with hardware cursor detection in X11. +243=Tom Breton +243_0=Added the functionality selection #ifndefs to allegro.h. +244=Tom St Denis +244_0=Fixed clipping of transparent objects. +245=Tore Halse +245_0=Made Allegro windows always popup centred in Windows and made fixes to the documentation. +246=V Karthik Kumar +246_0=Added a Tamil language greeting to exunicode, added switches to use the Intel compiler in Windows and added a password option to the Windows screensaver example. Also fixed a problem with allegro-config. +247=Victor Williams Stafusa da Silva +247_0=Changed a few occurences of "256" to PAL_SIZE and made OS type detection handle Windows 2003 and Windows Vista. +248=Ville Skytta +248_0=Fixed a problem with make install libdir= and modules on Unix systems. +249=Vitaliy Chetverikov +249_0=Fixed a bug in the GUI where the return value of MSG_IDLE was ignored. +[readme] +text=Welcome to the Allegro demonstration game, by Shawn Hargreaves. Your mission: to go where noone has gone before, to seek out strange new life, and to boldly blast it to smithereens. Your controls: the arrow keys to move left and right, the up arrow to accelerate (the faster you go, the more score you get), and the space bar to fire. What complexity! What subtlety. What originality. But enough of that. On to the serious stuff... -------- Introduction -------- Allegro is a cross-platform library intended for use in computer games and other types of multimedia programming. It was initially conceived on the Atari ST, but that platform sadly died during childbirth. After a brief stay with Borland C, it was adopted by the fantastic djgpp compiler, where it grew to maturity. In the fullness of time it gave birth to children of its own, who went to live in such exotic locations as DirectX and the X Server, but the entire family is now back together again, living in harmony as a single portable entity. How about that for a mixture of metaphors? :-) A wide range of extension packages and add-on modules are also available, which can be found in the "Library Extensions" section of the Allegro.cc website, http://www.allegro.cc/. According to the Oxford Companion to Music, Allegro is the Italian for "quick, lively, bright". It is also a recursive acronym which stands for "Allegro Low Level Game Routines". -------- Features -------- Cross-platform support for DOS, Windows, Unix, BeOS, QNX and MacOS X systems. Drawing functions including putpixel, getpixel, lines, rectangles, flat shaded, gouraud shaded, texture mapped, and z-buffered polygons, circles, floodfill, bezier splines, patterned fills, masked, run length encoded, and compiled sprites, blitting, bitmap scaling and rotation, translucency/lighting, and text output with proportional fonts. Supports clipping, and can draw directly to the screen or to memory bitmaps of any size. DOS graphics drivers for VGA mode 13h, mode-X (twenty three tweaked VGA resolutions plus unchained 640x400 Xtended mode), and SVGA modes with 8, 15, 16, 24, and 32 bit color depths, taking full advantage of VBE 2.0 linear framebuffers and the VBE/AF hardware accelerator API if they are available. Additional video hardware support is available from the FreeBE/AF project (http://www.talula.demon.co.uk/freebe/). Windows graphics drivers using DirectX in fullscreen and windowed modes, plus routines for drawing onto GDI device contexts. Unix graphics drivers for X, DGA2, fbcon, SVGAlib, VBE/AF, mode-X, and standard VGA. BeOS graphics drivers using BWindowScreen in fullscreen and BDirectWindow in windowed modes. MacOS X native graphics drivers using CGDirectDisplay API for direct fullscreen gfx access and QuickDraw in a Cocoa window in windowed mode. Hardware scrolling and triple buffering (where available), mode-X split screens, and palette manipulation. FLI/FLC animation player. Plays background MIDI music and up to 64 simultaneous sound effects, and can record sample waveforms and MIDI input. Samples can be looped (forwards, backwards, or bidirectionally), and the volume, pan, pitch, etc, can be adjusted while they are playing. The MIDI player responds to note on, note off, main volume, pan, pitch bend, and program change messages, using the General MIDI patch set and drum mappings. DOS version currently supports Adlib, SB, SB Pro, SB16, AWE32, MPU-401, ESS AudioDrive, Ensoniq Soundscape, and Windows Sound System. Windows version supports WaveOut and DirectSound interfaces and the system MIDI drivers. Unix version supports OSS, ESD, and ALSA sound drivers. BeOS version supports BSoundPlayer and BMidiSynth interfaces. MacOS X native version supports CoreAudio, Carbon Sound Manager and QuickTime Note Allocator interfaces. All versions provide software wavetable MIDI playback. Easy access to the mouse, keyboard, joystick, and high resolution timer interrupts, including a vertical retrace interrupt simulator in the DOS version. Routines for reading and writing LZSS compressed files. Multi-object data files and a grabber utility. Math functions including fixed point arithmetic, lookup table trig, and 3d vector/matrix/quaternion manipulation. GUI dialog manager and file selector. Built-in support for 16-bit and UTF-8 format Unicode characters. -------- Copyright -------- Allegro is gift-ware. It was created by a number of people working in cooperation, and is given to you freely as a gift. You may use, modify, redistribute, and generally hack it about in any way you like, and you do not have to give us anything in return. However, if you like this product you are encouraged to thank us by making a return gift to the Allegro community. This could be by writing an add-on package, providing a useful bug report, making an improvement to the library, or perhaps just releasing the sources of your program so that other people can learn from them. If you redistribute parts of this code or make a game using it, it would be nice if you mentioned Allegro somewhere in the credits, but you are not required to do this. We trust you not to abuse our generosity. Disclaimer: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------- Contact info -------- The latest version of Allegro can always be found on the Allegro homepage, http://alleg.sourceforge.net/. There are three mailing lists for Allegro-related discussion, each with a slightly different purpose. [AL] - Allegro main - http://lists.sourceforge.net/lists/listinfo/alleg-main/. This list is for any kind of discussion about Allegro, questions about Allegro, reports of problems with Allegro, suggestions for new features, announcements of programs written using Allegro, etc. General rule: if it has to do with Allegro, you can post it here. If not, go somewhere else (for example comp.os.msdos.djgpp, comp.lang.c, or the online forums at http://www.allegro.cc/). [AD] - Allegro developers - http://lists.sourceforge.net/lists/listinfo/alleg-developers/. This list is for the people currently working on Allegro, who use it to coordinate their efforts. You can use this address if you need to contact the developers directly, for example to submit some new code that you have written or to report a bug. Unlike the other lists, we will be really rude to people who post inappropriate material here, so please don't do that! Do not send tech-support questions to this list. Don't post bug reports here unless you are 100% certain they aren't your fault (if you are in any doubt, use the main Allegro list instead, which is read by most of the same people who are subscribed here). The Allegro development is a completely open process, and everyone is welcome to drop by, have a listen, and start contributing code patches. This list is for working rather than talking, though, so please don't do anything that might get in our way. [Alleg5] - Allegro 5 - http://lists.sourceforge.net/mailman/listinfo/alleg-bigfive. This list was once available for discussing the next major version of Allegro, when it was too noisy to do so on [AD]. This is no longer the case so the list has been shut down. However, its archives are still valuable. To subscribe to one of the three lists, simply go to it's web page and use the online forms to subscribe yourself. You can remove yourself from a list going to the same page above, which can be used to remind you of your password too, in case you have forgotten it. To send a message to one of the lists, write to alleg-main@lists.sourceforge.net or alleg-developers@lists.sourceforge.net. You don't need to be subscribed to these mailing lists before you can post there, but it is a good idea to subscribe in order to see the replies. Before posting tech-support questions to the Allegro list, please take a moment to read the guidelines in docs/txt/help.txt. See docs/txt/ahack.txt for information about the style of code we use, and how to create your patches. If you want to search through the archives of any of those mailing lists, you will have to check the available options at http://alleg.sourceforge.net/maillist.html. Please don't send messages in HTML format. The increased size places an unnecessary load on the server, and many subscribers have a hard time reading these posts. Please do not crosspost between these lists. Choose the most appropriate one for your message, and then send it only to that list. Please don't send large binary attachments to any of the lists, they will be rejected by the size limit filter, which is set to 100KB for the developers mailing list, and 40KB for the others. Upload your files to a website and then post the URL, or if you can't do that, post an announcement asking people to write to you privately, and then send the file by individual email to whoever responded. Please use English in your messages. You could eventually post messages in whatever language you prefer, but that would terribly limit the chances of getting a useful answer. Remember that the RFC 1855: netiquette guidelines (http://www.rfc-editor.org/rfc/rfc1855.txt) describes other general guidelines you should follow as a correct internet user (in mailing lists and other places as well), and provides more verbose descriptions and explanations about why you should follow the above guidelines. One of the important guidelines you should be aware of is how to quote correctly the message you are replying to. The previous RFC doesn't really explain how to do it, so you might want to read the document "How do I quote correctly in Usenet?" at http://www.netmeister.org/news/learn2quote.html. Quoting correctly is easier to say than to do, especially for users of Microsoft Outlook. If you are such a user, you can help yourself using the Outlook-QuoteFix extension written by Dominik Jain, which you can find at http://home.in.tum.de/~jain/software/outlook-quotefix/. diff --git a/demos/shooter/demo.c b/demos/shooter/demo.c new file mode 100644 index 0000000000..0c6985b8ae --- /dev/null +++ b/demos/shooter/demo.c @@ -0,0 +1,133 @@ +#include "demo.h" +#include "data.h" +#include "expl.h" +#include "title.h" +#include "game.h" +#include + +/* command line options */ +int cheat = FALSE; +int jumpstart = FALSE; + +int max_fps = FALSE; +PALETTE *palette; + +ALLEGRO_COLOR get_palette(int p) { + if (!palette) return makecol(0, 0, 0); + return palette->rgb[p]; +} + +void set_palette(PALETTE *p) { + palette = p; +} + + + +void fade_out(int skip) +{ + ALLEGRO_BITMAP *capture = al_create_bitmap(SCREEN_W, SCREEN_H); + al_set_target_bitmap(capture); + al_draw_bitmap(al_get_backbuffer(screen), 0, 0, 0); + al_set_target_backbuffer(screen); + + int steps = 128 / skip; + if (steps < 1) steps = 1; + double t0 = al_get_time(); + for (int i = 0; i < steps; i++) { + al_rest(t0 + (i + 1) / 120.0 - al_get_time()); + ALLEGRO_COLOR fade = al_map_rgba_f(0, 0, 0, 1.0 * (i + 1) / steps); + al_draw_bitmap(capture, 0, 0, 0); + al_draw_filled_rectangle(0, 0, SCREEN_W, SCREEN_H, fade); + al_flip_display(); + poll_input(); + if (keypressed()) break; + } + al_destroy_bitmap(capture); +} + + +static void intro_screen(void) +{ + play_sample(data[INTRO_SPL].dat, 255, 128, 1000, FALSE); + + int t0 = al_get_time(); + for (int i = 0; i < 51; i++) { + int x = i % 8; + int y = i / 8; + stretch_blit(data[INTRO_ANIM].dat, x * 320, y * 200, 320, 200, 0, 0, SCREEN_W, SCREEN_H); + al_flip_display(); + double dt = t0 + i * 0.050 - al_get_time(); + al_rest(dt); + } + + rest(1000); + fade_out(1); +} + + + +int main(int argc, char *argv[]) +{ + int c; + int w, h; + + for (c = 1; c < argc; c++) { + if (stricmp(argv[c], "-cheat") == 0) + cheat = TRUE; + + if (stricmp(argv[c], "-jumpstart") == 0) + jumpstart = TRUE; + } + + srand(time(NULL)); + if (!allegro_init()) + return 1; + + ALLEGRO_MONITOR_INFO info; + al_get_monitor_info(0, &info); + w = (info.x2 - info.x1) * 0.75; + h = (info.y2 - info.y1) * 0.75; + + al_set_new_display_flags(ALLEGRO_RESIZABLE); + screen = al_create_display(w, h); + if (!screen) { + allegro_message("Error setting graphics mode\n"); + exit(1); + } + al_init_image_addon(); + al_init_acodec_addon(); + install_keyboard(); + install_mouse(); + install_timer(); + al_init_font_addon(); + al_init_ttf_addon(); + al_init_primitives_addon(); + + font = al_create_builtin_font(); + + if (!install_sound()) { + allegro_message("Error initialising sound\n%s\n", allegro_error); + } + + //if (install_joystick(JOY_TYPE_AUTODETECT) != 0) { + //allegro_message("Error initialising joystick\n%s\n", allegro_error); + //install_joystick(JOY_TYPE_NONE); + //} + + data_load(); + + if (!jumpstart) { + intro_screen(); + } + + generate_explosions(); + + while (title_screen()) + play_game(); + + destroy_explosions(); + + stop_midi(); + + return 0; +} diff --git a/demos/shooter/demo.h b/demos/shooter/demo.h new file mode 100644 index 0000000000..986ebeaf3e --- /dev/null +++ b/demos/shooter/demo.h @@ -0,0 +1,35 @@ +#ifndef DEMO_H_INCLUDED +#define DEMO_H_INCLUDED + +#define ALLEGRO_UNSTABLE +#include +#include +#include +#include +#include +#include +#include "../speed/a4_aux.h" +#include +#include +#include +#include +#include "data.h" + +extern int max_fps; +extern int cheat; +typedef struct PALETTE PALETTE; +#define PAL_SIZE 256 +struct PALETTE { + ALLEGRO_COLOR rgb[PAL_SIZE]; +}; +typedef ALLEGRO_FONT FONT; +typedef ALLEGRO_SAMPLE SAMPLE; +#define SCREEN_W (al_get_display_width(al_get_current_display())) +#define SCREEN_H (al_get_display_height(al_get_current_display())) + + +ALLEGRO_COLOR get_palette(int p); +void set_palette(PALETTE *p); +void fade_out(int divider); + +#endif diff --git a/demos/shooter/expl.c b/demos/shooter/expl.c new file mode 100644 index 0000000000..0630748dc9 --- /dev/null +++ b/demos/shooter/expl.c @@ -0,0 +1,83 @@ +#include "expl.h" + +RLE_SPRITE *explosion[EXPLODE_FRAMES]; + +/* the explosion graphics are pregenerated, using a simple particle system */ +void generate_explosions(void) +{ + uint8_t bmp[EXPLODE_SIZE * EXPLODE_SIZE]; + unsigned char *p; + int c, c2; + int x, y; + int xx, yy; + int color; + +#define HOTSPOTS 128 + + struct HOTSPOT { + int x, y; + int xc, yc; + } hot[HOTSPOTS]; + + for (c = 0; c < HOTSPOTS; c++) { + hot[c].x = hot[c].y = (EXPLODE_SIZE / 2) << 16; + hot[c].xc = (AL_RAND() & 0x1FFFF) - 0xFFFF; + hot[c].yc = (AL_RAND() & 0x1FFFF) - 0xFFFF; + } + + for (c = 0; c < EXPLODE_FRAMES; c++) { + memset(bmp, 0, EXPLODE_SIZE * EXPLODE_SIZE); + + color = ((c < 16) ? c * 4 : (80 - c)) >> 2; + + for (c2 = 0; c2 < HOTSPOTS; c2++) { + for (x = -12; x <= 12; x++) { + for (y = -12; y <= 12; y++) { + xx = (hot[c2].x >> 16) + x; + yy = (hot[c2].y >> 16) + y; + if ((xx > 0) && (yy > 0) && (xx < EXPLODE_SIZE) + && (yy < EXPLODE_SIZE)) { + p = bmp + yy * EXPLODE_SIZE + xx; + *p += (color >> ((ABS(x) + ABS(y)) / 3)); + if (*p > 63) + *p = 63; + } + } + } + hot[c2].x += hot[c2].xc; + hot[c2].y += hot[c2].yc; + } + + explosion[c] = al_create_bitmap(EXPLODE_SIZE, EXPLODE_SIZE); + ALLEGRO_LOCKED_REGION *locked = al_lock_bitmap(explosion[c], ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, ALLEGRO_LOCK_WRITEONLY); + + PALETTE *pal = data[GAME_PAL].dat; + for (x = 0; x < EXPLODE_SIZE; x++) { + for (y = 0; y < EXPLODE_SIZE; y++) { + c2 = bmp[y * EXPLODE_SIZE + x]; + if (c2 < 8) + c2 = 0; + else + c2 = 16 + c2 / 4; + + uint8_t *lp = (uint8_t *)locked->data + y * locked->pitch + x * 4; + lp[0] = pal->rgb[c2].r * 255; + lp[1] = pal->rgb[c2].g * 255; + lp[2] = pal->rgb[c2].b * 255; + lp[3] = pal->rgb[c2].a * 255; + } + } + + + al_unlock_bitmap(explosion[c]); + } +} + + + +void destroy_explosions(void) +{ + int c; + for (c = 0; c < EXPLODE_FRAMES; c++) + al_destroy_bitmap(explosion[c]); +} diff --git a/demos/shooter/expl.h b/demos/shooter/expl.h new file mode 100644 index 0000000000..db843f41f0 --- /dev/null +++ b/demos/shooter/expl.h @@ -0,0 +1,16 @@ +#ifndef EXPL_H_INCLUDED +#define EXPL_H_INCLUDED + +#include "demo.h" + +/* explosion graphics */ +#define EXPLODE_FLAG 100 +#define EXPLODE_FRAMES 64 +#define EXPLODE_SIZE 160 + +extern RLE_SPRITE *explosion[EXPLODE_FRAMES]; + +void generate_explosions(void); +void destroy_explosions(void); + +#endif diff --git a/demos/shooter/game.c b/demos/shooter/game.c new file mode 100644 index 0000000000..96a46d831c --- /dev/null +++ b/demos/shooter/game.c @@ -0,0 +1,465 @@ +#include "game.h" +#include "data.h" +#include "bullet.h" +#include "expl.h" +#include "star.h" +#include "aster.h" + +#define BULLET_DELAY 20 + +/* the current score */ +int score; +static char score_buf[80]; +int player_x_pos; +int player_hit; +int ship_state; +int skip_count; + +/* info about the state of the game */ +static int dead; +static int xspeed, yspeed, ycounter; +static int ship_burn; +static int ship_count; +static int skip_speed; +static volatile int frame_count, fps; +static volatile unsigned int game_time; +static unsigned int prev_bullet_time; +static int new_asteroid_time; +static int score_pos; +static ALLEGRO_SAMPLE_ID engine; + +#define MAX_SPEED 32 + + + +/* handles fade effects and timing for the ready, steady, go messages */ +static int fade_intro_item(int music_pos, int fade_speed) +{ + set_palette(data[GAME_PAL].dat); + fade_out(fade_speed); + return keypressed(); +} + + + +/* draws one of the ready, steady, go messages */ +static void draw_intro_item(int item, int size) +{ + BITMAP *b = (BITMAP *) data[item].dat; + int w = MIN(SCREEN_W, (SCREEN_W * 2 / size)); + int h = SCREEN_H / size; + + //clear_bitmap(screen); + int bw = al_get_bitmap_width(b); + int bh = al_get_bitmap_height(b); + al_clear_to_color(makecol(0, 0, 0)); + stretch_blit(b, 0, 0, bw, bh, (SCREEN_W - w) / 2, + (SCREEN_H - h) / 2, w, h); + al_flip_display(); +} + + + +/* the main game update function */ +static void move_everyone(void) +{ + BULLET *bullet; + + score++; + + if (player_hit) { + /* player dead */ + if (skip_count <= 0) { + if (ship_state >= EXPLODE_FLAG + EXPLODE_FRAMES - 1) { + if (--ship_count <= 0) + dead = TRUE; + else + player_hit = FALSE; + } + else + ship_state++; + + if (yspeed) + yspeed--; + } + } + else { + if (skip_count <= 0) { + if ((key[ALLEGRO_KEY_LEFT])) { // || (joy[0].stick[0].axis[0].d1)) { + /* moving left */ + if (xspeed > -MAX_SPEED) + xspeed -= 2; + } + else if ((key[ALLEGRO_KEY_RIGHT])) { // || (joy[0].stick[0].axis[0].d2)) { + /* moving right */ + if (xspeed < MAX_SPEED) + xspeed += 2; + } + else { + /* decelerate */ + if (xspeed > 0) + xspeed -= 2; + else if (xspeed < 0) + xspeed += 2; + } + } + + /* which ship sprite to use? */ + if (xspeed < -24) + ship_state = SHIP1; + else if (xspeed < -2) + ship_state = SHIP2; + else if (xspeed <= 2) + ship_state = SHIP3; + else if (xspeed <= 24) + ship_state = SHIP4; + else + ship_state = SHIP5; + + /* move player */ + player_x_pos += xspeed; + if (player_x_pos < (32 << SPEED_SHIFT)) { + player_x_pos = (32 << SPEED_SHIFT); + xspeed = 0; + } + else if (player_x_pos >= ((SCREEN_W - 32) << SPEED_SHIFT)) { + player_x_pos = ((SCREEN_W - 32) << SPEED_SHIFT); + xspeed = 0; + } + + if (skip_count <= 0) { + if ((key[ALLEGRO_KEY_UP])) { // || (joy[0].stick[0].axis[1].d1)) { + /* firing thrusters */ + if (yspeed < MAX_SPEED) { + if (yspeed == 0) { + al_stop_sample(&engine); + al_play_sample(data[ENGINE_SPL].dat, 0.9, -1 + 2 * PAN(player_x_pos >> SPEED_SHIFT) / 255.0, + 1.0, ALLEGRO_PLAYMODE_LOOP, &engine); + } + else { + /* fade in sample while speeding up */ + ALLEGRO_SAMPLE_INSTANCE *si = al_lock_sample_id(&engine); + al_set_sample_instance_gain(si, yspeed * 64 / MAX_SPEED / 255.0); + al_set_sample_instance_pan(si, -1 + 2 * PAN(player_x_pos >> SPEED_SHIFT) / 255.0); + al_unlock_sample_id(&engine); + } + yspeed++; + } + else { + /* adjust pan while the sample is looping */ + ALLEGRO_SAMPLE_INSTANCE *si = al_lock_sample_id(&engine); + al_set_sample_instance_gain(si, 64 / 255.0); + al_set_sample_instance_pan(si, -1 + 2 * PAN(player_x_pos >> SPEED_SHIFT) / 255.0); + al_unlock_sample_id(&engine); + } + + ship_burn = TRUE; + score++; + } + else { + /* not firing thrusters */ + if (yspeed) { + yspeed--; + if (yspeed == 0) { + al_stop_sample(&engine); + } + else { + /* fade out and reduce frequency when slowing down */ + ALLEGRO_SAMPLE_INSTANCE *si = al_lock_sample_id(&engine); + al_set_sample_instance_gain(si, yspeed * 64 / MAX_SPEED / 255.0); + al_set_sample_instance_pan(si, -1 + 2 * PAN(player_x_pos >> SPEED_SHIFT) / 255.0); + al_set_sample_instance_speed(si, (500 + yspeed * 500 / MAX_SPEED) / 1000.0); + al_unlock_sample_id(&engine); + } + } + + ship_burn = FALSE; + } + } + } + + /* if going fast, move everyone else down to compensate */ + if (yspeed) { + ycounter += yspeed; + + while (ycounter >= (1 << SPEED_SHIFT)) { + for (bullet = bullet_list; bullet; bullet = bullet->next) + bullet->y++; + + scroll_stars(); + + scroll_asteroids(); + + ycounter -= (1 << SPEED_SHIFT); + } + } + + move_bullets(); + + starfield_2d(); + + /* fire bullet? */ + if (!player_hit) { + if ((key[ALLEGRO_KEY_SPACE] || key[ALLEGRO_KEY_ENTER] || key[ALLEGRO_KEY_LCTRL] || key[ALLEGRO_KEY_RCTRL])) { + // ||(joy[0].button[0].b) || (joy[0].button[1].b)) { + if (prev_bullet_time + BULLET_DELAY < game_time) { + bullet = add_bullet((player_x_pos >> SPEED_SHIFT) - 2, SCREEN_H - 64); + if (bullet) { + play_sample(data[SHOOT_SPL].dat, 100, PAN(bullet->x), 1000, + FALSE); + prev_bullet_time = game_time; + } + } + } + } + + move_asteroids(); + + if (skip_count <= 0) { + skip_count = skip_speed; + + /* make a new alien? */ + new_asteroid_time++; + + if (new_asteroid_time > 600) { + add_asteroid(); + new_asteroid_time = 0; + } + } + else + skip_count--; +} + + + +/* main screen update function */ +static void draw_screen(void) +{ + int x; + RLE_SPRITE *spr; + + //acquire_bitmap(bmp); + al_clear_to_color(makecol(0, 0, 0)); + + draw_starfield_2d(); + + /* draw the player */ + x = player_x_pos >> SPEED_SHIFT; + + if ((ship_burn) && (ship_state < EXPLODE_FLAG)) { + spr = data[ENGINE1 + (retrace_count() / 4) % 7].dat; + int sprw = al_get_bitmap_width(spr); + draw_sprite(spr, x - sprw / 2, SCREEN_H - 24); + } + + if (ship_state >= EXPLODE_FLAG) + spr = explosion[ship_state - EXPLODE_FLAG]; + else + spr = (RLE_SPRITE *) data[ship_state].dat; + + int sprw = al_get_bitmap_width(spr); + int sprh = al_get_bitmap_height(spr); + draw_sprite(spr, x - sprw / 2, SCREEN_H - 42 - sprh / 2); + + /* draw the asteroids */ + draw_asteroids(); + + /* draw the bullets */ + draw_bullets(); + + /* draw the score and fps information */ + if (fps) + sprintf(score_buf, "Lives: %d - Score: %d - (%d fps)", + ship_count, score, fps); + else + sprintf(score_buf, "Lives: %d - Score: %d", ship_count, score); + + textout(data[TITLE_FONT].dat, score_buf, 0, 0, get_palette(7)); + + //release_bitmap(bmp); +} + + + +static void move_score(void) +{ + score_pos++; + if (score_pos > SCREEN_H) + score_pos = 0; +} + + + +static void draw_score(void) +{ + ALLEGRO_TRANSFORM tr; + al_identity_transform(&tr); + al_rotate_transform(&tr, score_pos * ALLEGRO_PI / 300); + al_translate_transform(&tr, score_pos, score_pos); + al_use_transform(&tr); + textout_centre(data[END_FONT].dat, "GAME OVER", 0, -24, get_palette(2)); + sprintf(score_buf, "Score: %d", score); + textout_centre(data[END_FONT].dat, score_buf, 0, 24, get_palette(2)); + al_identity_transform(&tr); + al_use_transform(&tr); +} + + +/* sets up and plays the game */ +void play_game(void) +{ + int esc = FALSE; + unsigned int prev_update_time; + + stop_midi(); + + /* set up a load of globals */ + dead = player_hit = FALSE; + player_x_pos = (SCREEN_W / 2) << SPEED_SHIFT; + xspeed = yspeed = ycounter = 0; + ship_state = SHIP3; + ship_burn = FALSE; + ship_count = 3; /* 3 lives instead of one... */ + frame_count = fps = 0; + bullet_list = NULL; + score = 0; + score_pos = 0; + + skip_count = 0; + if (SCREEN_W < 400) + skip_speed = 0; + else if (SCREEN_W < 700) + skip_speed = 1; + else if (SCREEN_W < 1000) + skip_speed = 2; + else + skip_speed = 3; + + init_starfield_2d(); + + init_asteroids(); + new_asteroid_time = 0; + + /* introduction synced to the music */ + draw_intro_item(INTRO_BMP_1, 5); + play_midi(data[GAME_MUSIC].dat, TRUE); + clear_keybuf(); + + if (fade_intro_item(-1, 2)) + goto skip; + + draw_intro_item(INTRO_BMP_2, 4); + if (fade_intro_item(5, 2)) + goto skip; + + draw_intro_item(INTRO_BMP_3, 3); + if (fade_intro_item(9, 4)) + goto skip; + + draw_intro_item(INTRO_BMP_4, 2); + if (fade_intro_item(11, 4)) + goto skip; + + draw_intro_item(GO_BMP, 4); + if (fade_intro_item(13, 16)) + goto skip; + + draw_intro_item(GO_BMP, 4); + if (fade_intro_item(14, 16)) + goto skip; + + draw_intro_item(GO_BMP, 4); + if (fade_intro_item(15, 16)) + goto skip; + + draw_intro_item(GO_BMP, 4); + if (fade_intro_item(16, 16)) + goto skip; + + skip: + + al_clear_to_color(makecol(0, 0, 0)); + + clear_keybuf(); + + set_palette(data[GAME_PAL].dat); + + game_time = 0; + prev_bullet_time = 0; + prev_update_time = 0; + int speed = 6400 / SCREEN_W; + double t0 = al_get_time(); + double fps_t0 = t0; + + if (speed < 4) speed = 4; + + /* main game loop */ + while (!esc) { + int updated = 0; + double t = al_get_time(); + + poll_input(); + //poll_joystick(); + + game_time = (t - t0) * 1000 / speed; + if (t > fps_t0 + 1) { + fps_t0 = t; + fps = frame_count; + frame_count = 0; + } + + while (prev_update_time < game_time) { + if (dead) { + move_score(); + } + else { + move_everyone(); + if (dead) { + clear_keybuf(); + } + } + prev_update_time++; + updated = 1; + } + + if (max_fps || updated) { + draw_screen(); + if (dead) { + draw_score(); + } + + al_flip_display(); + + frame_count++; + } + + /* rest for a short while if we're not in CPU-hog mode and too fast */ + if (!max_fps && !updated) { + rest(1); + } + + poll_input(); + + if (key[ALLEGRO_KEY_ESCAPE] || (dead && ( + keypressed()))) // || joy[0].button[0].b || joy[0].button[1].b))) + esc = TRUE; + } + + /* cleanup */ + al_stop_sample(&engine); + + while (bullet_list) + delete_bullet(bullet_list); + + if (esc) { + do { + poll_input(); + } while (key[ALLEGRO_KEY_ESCAPE]); + + fade_out(5); + return; + } + + clear_keybuf(); + fade_out(5); +} diff --git a/demos/shooter/game.h b/demos/shooter/game.h new file mode 100644 index 0000000000..3bed0ac64b --- /dev/null +++ b/demos/shooter/game.h @@ -0,0 +1,18 @@ +#ifndef GAME_H_INCLUDED +#define GAME_H_INCLUDED + +#include "demo.h" + +/* for doing stereo sound effects */ +#define PAN(x) (((x) * 256) / SCREEN_W) +#define SPEED_SHIFT 3 + +extern int score; +extern int player_x_pos; +extern int player_hit; +extern int ship_state; +extern int skip_count; + +void play_game(void); + +#endif diff --git a/demos/shooter/star.c b/demos/shooter/star.c new file mode 100644 index 0000000000..be722d7f40 --- /dev/null +++ b/demos/shooter/star.c @@ -0,0 +1,127 @@ +#include "star.h" + +/* for the starfield */ +#define MAX_STARS 512 + +volatile struct { + al_fixed x, y, z; + int ox, oy; +} star[MAX_STARS]; + +static int star_count = 0; +static int star_count_count = 0; + + + +void init_starfield_2d(void) +{ + int c; + for (c = 0; c < MAX_STARS; c++) { + star[c].ox = AL_RAND() % SCREEN_W; + star[c].oy = AL_RAND() % SCREEN_H; + star[c].z = AL_RAND() & 7; + } +} + + + +void starfield_2d(void) +{ + int c; + for (c = 0; c < MAX_STARS; c++) { + if ((star[c].oy += ((int)star[c].z >> 1) + 1) >= SCREEN_H) + star[c].oy = 0; + } +} + + + +void scroll_stars(void) +{ + int c; + for (c = 0; c < MAX_STARS; c++) { + if (++star[c].oy >= SCREEN_H) + star[c].oy = 0; + } +} + + + +void draw_starfield_2d() +{ + int x, y, c; + for (c = 0; c < MAX_STARS; c++) { + y = star[c].oy; + x = ((star[c].ox - SCREEN_W / 2) * (y / (4 - star[c].z / 2) + + SCREEN_H) / SCREEN_H) + + SCREEN_W / 2; + + al_draw_filled_circle(x, y, 1, get_palette(15 - (int)star[c].z)); + } +} + + + +void init_starfield_3d(void) +{ + int c; + for (c = 0; c < MAX_STARS; c++) { + star[c].z = 0; + star[c].ox = star[c].oy = -1; + } +} + +void starfield_3d(void) +{ + int c; + al_fixed x, y; + int ix, iy; + + for (c = 0; c < star_count; c++) { + if (star[c].z <= itofix(1)) { + x = itofix(AL_RAND() & 0xff); + y = itofix(((AL_RAND() & 3) + 1) * SCREEN_W); + + star[c].x = fixmul(fixcos(x), y); + star[c].y = fixmul(fixsin(x), y); + star[c].z = itofix((AL_RAND() & 0x1f) + 0x20); + } + + x = fixdiv(star[c].x, star[c].z); + y = fixdiv(star[c].y, star[c].z); + + ix = (int)(x >> 16) + SCREEN_W / 2; + iy = (int)(y >> 16) + SCREEN_H / 2; + + if ((ix >= 0) && (ix < SCREEN_W) && (iy >= 0) + && (iy <= SCREEN_H)) { + star[c].ox = ix; + star[c].oy = iy; + star[c].z -= 4096; + } + else { + star[c].ox = -1; + star[c].oy = -1; + star[c].z = 0; + } + } + + /* wake up new star */ + if (star_count < MAX_STARS) { + if (star_count_count++ >= 8) { + star_count_count = 0; + star_count++; + } + } +} + + + +void draw_starfield_3d(void) +{ + int c, c2; + for (c = 0; c < star_count; c++) { + c2 = 7 - (int)(star[c].z >> 18); + al_draw_filled_circle(star[c].ox, star[c].oy, 3, get_palette(CLAMP(0, c2, 7))); + } +} diff --git a/demos/shooter/star.h b/demos/shooter/star.h new file mode 100644 index 0000000000..b4e38bb0a9 --- /dev/null +++ b/demos/shooter/star.h @@ -0,0 +1,15 @@ +#ifndef STAR_H_INCLUDED +#define STAR_H_INCLUDED + +#include "demo.h" + +void init_starfield_2d(void); +void starfield_2d(void); +void scroll_stars(void); +void draw_starfield_2d(void); + +void init_starfield_3d(void); +void starfield_3d(void); +void draw_starfield_3d(void); + +#endif diff --git a/demos/shooter/title.c b/demos/shooter/title.c new file mode 100644 index 0000000000..5125e72b44 --- /dev/null +++ b/demos/shooter/title.c @@ -0,0 +1,358 @@ +#include "title.h" +#include "data.h" +#include "star.h" + +/* for parsing readme.txt */ +typedef struct TEXT_LIST { + char *text; + struct TEXT_LIST *next; +} TEXT_LIST; + +typedef struct README_SECTION { + TEXT_LIST *head; + TEXT_LIST *tail; + char *flat; + char *desc; +} README_SECTION; + +/* for parsing thanks._tx and the various source files */ +typedef struct CREDIT_NAME { + char *name; + char *text; + TEXT_LIST *files; + struct CREDIT_NAME *next; +} CREDIT_NAME; + +/* text messages (loaded from readme.txt) */ +static char *title_text; +static int title_size; + +static PALETTE title_palette; + +/* author credits scroller */ +static int credit_width = 0; +static int credit_scroll = 0; +static int credit_offset = 0; +static int credit_age = 0; +static int credit_speed = 32; +static int credit_skip = 1; + +/* text scroller at the bottom */ +static int text_scroll = 0; +static int text_char; +static int text_pix; +static int text_width; + +CREDIT_NAME *credit_name = NULL; + +static CREDIT_NAME *credits = NULL; +static ALLEGRO_CONFIG *text; + + +/* reads credit info from various places */ +static void load_credits(void) +{ + // exported the result from the original scanning which scanned all + // source files to a static text.ini with the ancient A4 credits :) + // (the original only worked when running from the A4 source folder) + text = al_load_config_file("data/text.ini"); + CREDIT_NAME *pc = NULL; + for (int i = 0; ; i++) { + char k[100]; + sprintf(k, "%d", i); + char const* vn = al_get_config_value(text, "credits", k); + if (!vn) break; + CREDIT_NAME *c = al_calloc(1, sizeof *c); + c->name = strdup(vn); + sprintf(k, "%d_0", i); + char const* v0 = al_get_config_value(text, "credits", k); + c->text = strdup(v0); + TEXT_LIST *ptl = NULL; + for (int j = 1; ;j++) { + sprintf(k, "%d_%d", i, j); + char const* v = al_get_config_value(text, "credits", k); + if (!v) break; + TEXT_LIST *tl = al_calloc(1, sizeof *tl); + tl->text = strdup(v); + if (ptl) + ptl->next = tl; + else + c->files = tl; + ptl = tl; + } + if (pc) + pc->next = c; + else + credits = c; + pc = c; + } + title_text = strdup(al_get_config_value(text, "readme", "text")); + title_size = strlen(title_text); +} + + + +static void scroller(void) +{ + int n; + TEXT_LIST *tl; + + starfield_3d(); + + /* move the scroller at the bottom */ + text_scroll += 4; + + /* update the credits position */ + if (credit_scroll <= 0) { + if (credit_name) + credit_name = credit_name->next; + + if (!credit_name) + credit_name = credits; + + if (credit_name) { + credit_width = + text_length(data[END_FONT].dat, credit_name->name) + 24; + + if (credit_name->text) + credit_scroll = al_get_text_width(data[TITLE_FONT].dat, credit_name->text) + SCREEN_W - + credit_width; + else + credit_scroll = 256; + + tl = credit_name->files; + n = 0; + + while (tl) { + n++; + tl = tl->next; + } + + credit_offset = SCREEN_W - credit_scroll; + + credit_age = 0; + } + } + else { + credit_scroll-=4; + credit_age+=4; + } +} + + + +static void draw_scroller(void) +{ + TEXT_LIST *tl; + int n, n2, c, c2, c3; + char *p; + FONT *bigfont = data[TITLE_FONT].dat; + int th = text_height(bigfont); + + /* draw the text scroller at the bottom */ + textout(bigfont, title_text, + SCREEN_W - text_scroll, SCREEN_H - th, makecol(255, 255, 255)); + + /* draw author file credits */ + if (credit_name) { + int x, y, z; + int ix, iy; + tl = credit_name->files; + n = credit_width; + n2 = 0; + + while (tl) { + c = 1024 + n2 * credit_speed - credit_age; + + if ((c > 0) && (c < 1024) && ((n2 % credit_skip) == 0)) { + x = itofix(SCREEN_W / 2); + y = itofix(SCREEN_H / 2 - 32); + + c2 = c * ((n / 13) % 17 + 1) / 32; + if (n & 1) + c2 = -c2; + + c2 -= 96; + + c3 = (32 + + fixtoi(ABS(fixsin(itofix(c / (15 + n % 42) + n))) * + 128)) * SCREEN_W / 640; + + x += fixsin(itofix(c2)) * c3; + y += fixcos(itofix(c2)) * c3; + + if (c < 512) { + z = fixsqrt(itofix(c) / 512); + + x = fixmul(itofix(32), itofix(1) - z) + fixmul(x, z); + y = fixmul(itofix(16), itofix(1) - z) + fixmul(y, z); + } + else if (c > 768) { + z = fixsqrt(itofix(1024 - c) / 256); + + if (n & 2) + x = fixmul(itofix(128), itofix(1) - z) + fixmul(x, z); + else + x = fixmul(itofix(SCREEN_W - 128), + itofix(1) - z) + fixmul(x, z); + + y = fixmul(itofix(SCREEN_H - 128), + itofix(1) - z) + fixmul(y, z); + } + + c = 128 + (512 - ABS(512 - c)) / 24; + c = MIN(255, c * 1.25); + + ix = fixtoi(x); + iy = fixtoi(y); + + c2 = strlen(tl->text); + ix -= c2 * 4; + + textout(bigfont, tl->text, ix, iy, get_palette(c)); + } + + tl = tl->next; + n += 1234567; + n2++; + } + } + + draw_starfield_3d(); + + /* draw author name/desc credits */ + if (credit_name) { + if (credit_name->text) { + c = credit_scroll + credit_offset; + p = credit_name->text; + c2 = strlen(p); + + textout(bigfont, p, c, 16, get_palette(255)); + } + + c = 4; + + if (credit_age < 100) + c -= (100 - credit_age) * (100 - + credit_age) * credit_width / 10000; + + if (credit_scroll < 150) + c += (150 - credit_scroll) * (150 - + credit_scroll) * SCREEN_W / + 22500; + + rectfill(0, 0, credit_width, 60, makecol(0, 0, 0)); + textprintf(data[END_FONT].dat, c, 4, makecol(255, 255, 255), "%s:", + credit_name->name); + } + + /* draw the Allegro logo over the top */ + draw_sprite(data[TITLE_BMP].dat, SCREEN_W / 2 - 160, + SCREEN_H / 2 - 96); +} + + + +/* displays the title screen */ +int title_screen(void) +{ + static int color = 0; + int c; + RGB rgb; + int updated; + int scroll_pos = 0; + + text_scroll = 0; + credit_width = 0; + credit_scroll = 0; + credit_offset = 0; + credit_age = 0; + credit_speed = 32; + credit_skip = 1; + + text_char = -1; + text_pix = 0; + text_width = 0; + + play_midi(data[TITLE_MUSIC].dat, TRUE); + play_sample(data[WELCOME_SPL].dat, 255, 127, 1000, FALSE); + + load_credits(); + + init_starfield_3d(); + + for (c = 0; c < 8; c++) + title_palette.rgb[c] = ((PALETTE*)(data[TITLE_PAL].dat))->rgb[c]; + + ///* set up the colors differently each time we display the title screen */ + for (c = 8; c < PAL_SIZE / 2; c++) { + rgb = ((RGB *) data[TITLE_PAL].dat)[c]; + switch (color) { + case 0: + rgb.b = rgb.r; + rgb.r = 0; + break; + case 1: + rgb.g = rgb.r; + rgb.r = 0; + break; + case 3: + rgb.g = rgb.r; + break; + } + title_palette.rgb[c] = rgb; + } + + for (c = PAL_SIZE / 2; c < PAL_SIZE; c++) + title_palette.rgb[c] = ((PALETTE *)(data[TITLE_PAL].dat))->rgb[c]; + + color++; + if (color > 3) + color = 0; + + al_clear_to_color(makecol(0, 0, 0)); + + set_palette(&title_palette); + + c = 1; + while (c < 160) { + stretch_blit(data[TITLE_BMP].dat, 0, 0, 320, 128, + SCREEN_W / 2 - c, SCREEN_H / 2 - c * 64 / 160 - 32, + c * 2, c * 128 / 160); + rest(5); + c++; + } + + blit(data[TITLE_BMP].dat, 0, 0, SCREEN_W / 2 - 160, + SCREEN_H / 2 - 96, 320, 128); + + clear_keybuf(); + + do { + updated = 0; + + scroller(); + scroll_pos++; + updated = 1; + + if (max_fps || updated) { + al_clear_to_color(makecol(0, 0, 0)); + draw_scroller(); + al_flip_display(); + } + + poll_input(); + rest(1); + } while (!keypressed()); // && (!joy[0].button[0].b) && (!joy[0].button[1].b)); + + + fade_out(5); + + while (keypressed()) + if ((readkey() & 0xff) == 27) + return FALSE; + + return TRUE; +} + + diff --git a/demos/shooter/title.h b/demos/shooter/title.h new file mode 100644 index 0000000000..1561e41e4a --- /dev/null +++ b/demos/shooter/title.h @@ -0,0 +1,9 @@ +#ifndef TITLE_H_INCLUDED +#define TITLE_H_INCLUDED + +#include "demo.h" + +int title_screen(void); +void end_title(void); + +#endif diff --git a/demos/speed/a4_aux.c b/demos/speed/a4_aux.c index 82af47779b..7251ae9dbe 100644 --- a/demos/speed/a4_aux.c +++ b/demos/speed/a4_aux.c @@ -16,6 +16,7 @@ #include "a4_aux.h" +ALLEGRO_AUDIO_STREAM *_midi_stream; /* @@ -140,6 +141,10 @@ void poll_input() switch (event.type) { + case ALLEGRO_EVENT_DISPLAY_RESIZE: + al_acknowledge_resize(event.display.source); + break; + case ALLEGRO_EVENT_KEY_DOWN: key[event.keyboard.keycode] = 1; break; @@ -276,6 +281,30 @@ ALLEGRO_BITMAP *replace_bitmap(ALLEGRO_BITMAP *bmp) +void stretch_blit(BITMAP *bitmap, int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2) { + al_draw_scaled_bitmap(bitmap, x1, y1, w1, h1, x2, y2, w2, h2, 0); +} + + + +void blit(BITMAP *bitmap, int x1, int y1, int x2, int y2, int w, int h) { + stretch_blit(bitmap, x1, y1, w, h, x2, y2, w, h); +} + + + +void draw_sprite(BITMAP *bitmap, int x, int y) { + al_draw_bitmap(bitmap, x, y, 0); +} + + + +void rotate_sprite(BITMAP *bitmap, int x, int y, int angle) { + al_draw_rotated_bitmap(bitmap, 0, 0, x, y, angle, 0); +} + + + /* approximate solid_mode() function, but we we use alpha for transparent * pixels instead of a mask color */ @@ -595,6 +624,14 @@ void rest(unsigned int time) +void install_timer() +{ + init_input(); + start_retrace_count(); +} + + + /* * Sound routines */ @@ -622,3 +659,39 @@ void play_sample(ALLEGRO_SAMPLE *spl, int vol, int pan, int freq, int loop) } + +int install_sound(void) +{ + if (!al_install_audio()) + return 0; + al_reserve_samples(100); + return 1; +} + + + +void play_midi(char const *midi, int loop) +{ + stop_midi(); + _midi_stream = al_load_audio_stream(midi, 2, 4096); + al_attach_audio_stream_to_mixer(_midi_stream, al_get_default_mixer()); + if (loop) { + al_set_audio_stream_playmode(_midi_stream, ALLEGRO_PLAYMODE_LOOP); + } +} + + + +void stop_midi(void) +{ + if (_midi_stream) { + al_destroy_audio_stream(_midi_stream); + _midi_stream = NULL; + } +} + + + +int AL_RAND() { + return rand(); +} diff --git a/demos/speed/a4_aux.h b/demos/speed/a4_aux.h index 350de945d6..fc3dba0604 100644 --- a/demos/speed/a4_aux.h +++ b/demos/speed/a4_aux.h @@ -1,7 +1,6 @@ #ifndef __A4_AUX_H__ #define __A4_AUX_H__ - #ifndef TRUE #define TRUE -1 #define FALSE 0 @@ -13,6 +12,7 @@ #define MIN(x,y) (((x) < (y)) ? (x) : (y)) #define MAX(x,y) (((x) > (y)) ? (x) : (y)) +#define CLAMP(x,y,z) MAX(x,MIN(z,y)) #undef ABS #define ABS(x) (((x) >= 0) ? (x) : (-(x))) @@ -38,21 +38,52 @@ extern struct ALLEGRO_FONT *font; extern struct ALLEGRO_FONT *font_video; +typedef struct DATAFILE DATAFILE; +struct DATAFILE { + void* dat; +}; +typedef ALLEGRO_BITMAP RLE_SPRITE; +typedef ALLEGRO_BITMAP BITMAP; +typedef ALLEGRO_COLOR RGB; +typedef ALLEGRO_FILE PACKFILE; + +#define allegro_init al_init +#define install_keyboard al_install_keyboard +#define install_mouse al_install_mouse +#define allegro_message printf +#define allegro_error "" +#define uisspace(x) ((x) == ' ' || (x) == '\n') +#define text_length(f, x) al_get_text_width(f, x) +#define text_height(f) al_get_font_line_height(f) +#define itofix al_itofix +#define fixtoi al_fixtoi +#define fixdiv al_fixdiv +#define fixsin al_fixsin +#define fixcos al_fixcos +#define fixsqrt al_fixsqrt +#define fixmul al_fixmul +#define stricmp strcmp +#define create_bitmap al_create_bitmap + const char *get_config_string(const ALLEGRO_CONFIG *cfg, const char *section, const char *name, const char *def); int get_config_int(const ALLEGRO_CONFIG *cfg, const char *section, const char *name, int def); void set_config_int(ALLEGRO_CONFIG *cfg, const char *section, const char *name, int val); -void init_input(); -void shutdown_input(); -void poll_input(); -void poll_input_wait(); -int keypressed(); -int readkey(); -void clear_keybuf(); +void init_input(void); +void shutdown_input(void); +void poll_input(void); +void poll_input_wait(void); +int keypressed(void); +int readkey(void); +void clear_keybuf(void); ALLEGRO_BITMAP *create_memory_bitmap(int w, int h); ALLEGRO_BITMAP *replace_bitmap(ALLEGRO_BITMAP *bmp); -void solid_mode(); +void stretch_blit(BITMAP *bitmap, int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2); +void blit(BITMAP *bitmap, int x1, int y1, int x2, int y2, int w, int h); +void draw_sprite(BITMAP *bitmap, int x, int y); +void rotate_sprite(BITMAP *bitmap, int x, int y, int angle); +void solid_mode(void); ALLEGRO_COLOR makecol(int r, int g, int b); void hline(int x1, int y, int x2, ALLEGRO_COLOR c); void vline(int x, int y1, int y2, ALLEGRO_COLOR c); @@ -72,14 +103,19 @@ void qtranslate_matrix_f(MATRIX_f *m, float x, float y, float z); void matrix_mul_f(const MATRIX_f *m1, const MATRIX_f *m2, MATRIX_f *out); void apply_matrix_f(const MATRIX_f *m, float x, float y, float z, float *xout, float *yout, float *zout); -void start_retrace_count(); -void stop_retrace_count(); -int64_t retrace_count(); +void start_retrace_count(void); +void stop_retrace_count(void); +int64_t retrace_count(void); void rest(unsigned int time); +void install_timer(void); struct ALLEGRO_SAMPLE *create_sample_u8(int freq, int len); void play_sample(struct ALLEGRO_SAMPLE *spl, int vol, int pan, int freq, int loop); +void play_midi(char const *filename, int loop); +void stop_midi(void); +int install_sound(void); +int AL_RAND(void); #endif /* __A4_AUX_H__ */ diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index ac2cc935a7..a8a5d25fca 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -15,7 +15,7 @@ mark_as_advanced(CTAGS) #-----------------------------------------------------------------------------# -option(DOC_GIT_REF "Git ref to use for source links in the documentation. If empty, will query git for this." "") +set(DOC_GIT_REF "" CACHE STRING "Git ref to use for source links in the documentation. If empty, will query git for this.") set(REAL_DOC_GIT_REF "") if(DOC_GIT_REF) diff --git a/docs/Refman.cmake b/docs/Refman.cmake index 86482f76de..f5fd01de1d 100644 --- a/docs/Refman.cmake +++ b/docs/Refman.cmake @@ -78,7 +78,9 @@ set(LATEX_DIR ${CMAKE_CURRENT_BINARY_DIR}/latex) set(PDF_DIR ${CMAKE_CURRENT_BINARY_DIR}/pdf) set(PROTOS ${CMAKE_CURRENT_BINARY_DIR}/protos) +set(API_EXAMPLES ${CMAKE_CURRENT_BINARY_DIR}/examples) set(PROTOS_TIMESTAMP ${PROTOS}.timestamp) +set(EXAMPLES_DIR ${CMAKE_SOURCE_DIR}/examples) set(HTML_REFS ${CMAKE_CURRENT_BINARY_DIR}/html_refs) set(HTML_REFS_TIMESTAMP ${HTML_REFS}.timestamp) set(INDEX_ALL ${CMAKE_CURRENT_BINARY_DIR}/index_all.txt) @@ -88,6 +90,7 @@ set(SCRIPT_DIR ${CMAKE_SOURCE_DIR}/docs/scripts) set(MAKE_PROTOS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/make_protos) set(MAKE_HTML_REFS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/make_html_refs) set(MAKE_INDEX ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/make_index) +set(SCAN_EXAMPLES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/scan_examples) set(MAKE_DOC ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/make_doc --pandoc "${PANDOC}" --protos ${PROTOS} @@ -110,6 +113,7 @@ add_executable(insert_timestamp scripts/insert_timestamp.c ${DAWK_SOURCES}) add_executable(make_search_index scripts/make_search_index.c ${DAWK_SOURCES}) +add_executable(scan_examples scripts/scan_examples.c ${DAWK_SOURCES}) #-----------------------------------------------------------------------------# # @@ -179,6 +183,41 @@ if(NOT WIN32) add_custom_target(gen_protos DEPENDS ${PROTOS}) endif() +#-----------------------------------------------------------------------------# +# +# API Examples +# +#-----------------------------------------------------------------------------# + +# Build a list of all the API entries. Then cross-reference these against +# which of the example files make use of them. + +set(RESP ${CMAKE_CURRENT_BINARY_DIR}/ex_files) + +file(GLOB EXAMPLE_FILES + ${EXAMPLES_DIR}/*.c + ${EXAMPLES_DIR}/*.cpp) + +file(GLOB EXAMPLE_FILES_REL + RELATIVE ${CMAKE_SOURCE_DIR} + ${EXAMPLES_DIR}/*.c + ${EXAMPLES_DIR}/*.cpp) + +foreach(f IN LISTS EXAMPLE_FILES_REL) + string(APPEND multiline "${f}\n") +endforeach() + +file(WRITE ${RESP} "${multiline}") + +add_custom_command( + OUTPUT ${API_EXAMPLES} + DEPENDS ${PROTOS} + ${EXAMPLE_FILES} + ${SCAN_EXAMPLES} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMAND ${SCAN_EXAMPLES} --protos ${PROTOS} "@${RESP}" > ${API_EXAMPLES}.t + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${API_EXAMPLES}.t ${API_EXAMPLES}) + #-----------------------------------------------------------------------------# # # HTML @@ -239,12 +278,14 @@ if(WANT_DOCS_HTML) ${CMAKE_CURRENT_BINARY_DIR}/inc.a.html ${CMAKE_CURRENT_BINARY_DIR}/inc.z.html ${SEARCH_INDEX_JS} + ${API_EXAMPLES} make_doc insert_timestamp COMMAND ${INSERT_TIMESTAMP} ${CMAKE_SOURCE_DIR}/include/allegro5/base.h > inc.timestamp.html COMMAND ${MAKE_DOC} + --examples ${API_EXAMPLES} --to html --raise-sections --include-before-body inc.a.html @@ -266,13 +307,13 @@ if(WANT_DOCS_HTML) OUTPUT ${HTML_DIR}/images/${image}.png DEPENDS ${SRC_REFMAN_DIR}/images/${image}.png - COMMAND + COMMAND "${CMAKE_COMMAND}" -E copy "${SRC_REFMAN_DIR}/images/${image}.png" "${HTML_DIR}/images/${image}.png" - ) + ) list(APPEND HTML_IMAGES ${HTML_DIR}/images/${image}.png) endforeach(image) - + add_custom_target(html ALL DEPENDS ${HTML_PAGES} ${HTML_IMAGES}) foreach(file pandoc.css autosuggest.js) diff --git a/docs/scripts/make_doc.c b/docs/scripts/make_doc.c index b64dc5e137..011a08305d 100644 --- a/docs/scripts/make_doc.c +++ b/docs/scripts/make_doc.c @@ -5,6 +5,7 @@ * * --pandoc PANDOC * --protos PROTOS-FILE + * --examples EXAMPLES-FILE * --to FORMAT (html, man, latex, texinfo, etc.) * --raise-sections * @@ -15,7 +16,7 @@ #include #include #include -#if defined(_BSD_SOURCE) || defined(_SVID_SOURCE) || (_XOPEN_SOURCE >= 500) +#if defined(_BSD_SOURCE) || defined(_SVID_SOURCE) || (_XOPEN_SOURCE >= 500) || defined(__APPLE__) #include #define USE_MKSTEMP 1 #elif defined(_MSC_VER) @@ -32,6 +33,7 @@ dstr pandoc = "pandoc"; dstr pandoc_options = ""; dstr protos_file = "protos"; +dstr examples_file = ""; dstr to_format = "html"; dstr allegro5_cfg_filename = ""; bool raise_sections = false; @@ -40,11 +42,13 @@ dstr tmp_pandoc_output; dstr git_ref = "master"; static Aatree *protos = &aa_nil; +static Aatree *examples = &aa_nil; static Aatree *sources = &aa_nil; static int process_options(int argc, char *argv[]); static void load_prototypes(const char *filename); +static void load_examples(const char *filename); static void generate_temp_file(char *filename); static void remove_temp_files(void); @@ -53,6 +57,7 @@ int main(int argc, char *argv[]) { argc = process_options(argc, argv); load_prototypes(protos_file); + load_examples(examples_file); generate_temp_file(tmp_preprocess_output); generate_temp_file(tmp_pandoc_output); @@ -88,6 +93,10 @@ static int process_options(int argc, char *argv[]) d_assign(protos_file, argv[i + 1]); i += 2; } + else if (streq(argv[i], "--examples")) { + d_assign(examples_file, argv[i + 1]); + i += 2; + } else if (streq(argv[i], "--to")) { d_assign(to_format, argv[i + 1]); i += 2; @@ -158,6 +167,35 @@ static void load_prototypes(const char *filename) d_close_input(); } +static void load_examples(const char *filename) +{ + dstr line; + const char *name; + const char *files; + + if (filename == NULL || *filename == '\0') { + return; + } + + d_open_input(filename); + + while (d_getline(line)) { + if (d_match(line, "([^:]*): ")) { + name = d_submatch(1); + files = d_after_match; + examples = aa_insert(examples, name, files); + } + } + + d_close_input(); +} + +const char* example_source(dstr buffer, const char *file_name, const char *line_number) { + sprintf(buffer, "https://github.com/liballeg/allegro5/blob/%s/%s#L%s", + git_ref, file_name, line_number); + return buffer; +} + char *load_allegro5_cfg(void) { @@ -203,6 +241,10 @@ const char *lookup_source(const char *name) return (r) ? r : ""; } +const char *lookup_example(const char *name) +{ + return aa_search(examples, name); +} void generate_temp_file(char *filename) { @@ -256,11 +298,15 @@ void call_pandoc(const char *input, const char *output, } } - sprintf(cmd, "\"%s\" %s %s %s --to %s --output %s", + sprintf(cmd, "\"%s\" %s %s %s --from markdown --to %s --output %s", pandoc, input_native, pandoc_options, extra_options, to_format, output); if (system(cmd) != 0) { d_abort("system call failed: ", cmd); } } +/* Local Variables: */ +/* c-basic-offset: 3 */ +/* End: */ + /* vim: set sts=3 sw=3 et: */ diff --git a/docs/scripts/make_doc.h b/docs/scripts/make_doc.h index 90fe1d76c4..dcd51586b8 100644 --- a/docs/scripts/make_doc.h +++ b/docs/scripts/make_doc.h @@ -15,6 +15,8 @@ extern dstr tmp_pandoc_output; const char *lookup_prototype(const char *name); const char *lookup_source(const char *name); +const char *lookup_example(const char *name); +const char* example_source(dstr buffer, const char *file_name, const char *line_number); extern void call_pandoc(const char *input, const char *output, const char *extra_options); extern void make_single_doc(int argc, char *argv[]); diff --git a/docs/scripts/make_single.c b/docs/scripts/make_single.c index 4c0af6f048..4ddb9033ab 100644 --- a/docs/scripts/make_single.c +++ b/docs/scripts/make_single.c @@ -8,6 +8,9 @@ static void postprocess_latex(void); static void cat(void); static void print_sans_backslashes(const char *p); +static void insert_examples(void); +static char current_api[64]; + void make_single_doc(int argc, char *argv[]) { d_init(argc, argv); @@ -37,6 +40,12 @@ static void preprocess(void) dstr line; while (d_getline(line)) { + /* If this is a heading, a new section is about to start. + Insert the pending code examples (if any) beforehand. */ + if (line[0] == '#') { + insert_examples(); + } + /* Raise sections by one level. Top-most becomes the document title. */ if (line[0] == '#' && raise_sections) { if (line[1] == ' ') { @@ -71,6 +80,7 @@ static void preprocess(void) d_printf("~~~~"); } d_printf("\n[Source Code](%s)\n", source); + strcpy(current_api, name); } else if (d_match(line, "^__ALLEGRO_5_CFG")) { char *allegro5_cfg = load_allegro5_cfg(); @@ -81,6 +91,8 @@ static void preprocess(void) d_print(line); } } + /* Finally insert any examples for the last section */ + insert_examples(); } static void postprocess_latex(void) @@ -92,7 +104,7 @@ static void postprocess_latex(void) * T-Rex doesn't seem to backtrack properly if we write "(sub)*". */ if (d_match(line, - "\\\\(sub)?(sub)?(sub)?(sub)?section\\{((al|ALLEGRO)[^}]+)")) { + "\\\\(sub)?(sub)?(sub)?(sub)?section\\{((al|ALLEGRO)[^}]+)")) { d_print(line); d_printf("\\label{"); print_sans_backslashes(d_submatch(5)); @@ -133,4 +145,38 @@ static void print_sans_backslashes(const char *p) } } +static void insert_examples(void) { + if (*current_api) { + const char* exs = lookup_example(current_api); + if (exs) { + /* This will be of the form "FILE:LINE FILE:LINE FILE:LINE " */ + dstr items; + char* pitem = strcpy(items, exs); + d_print("Examples:\n"); + char* item; + for (item = strtok(pitem, " "); item; item = strtok(NULL, " ")) { + dstr buffer; + char* colon = strchr(item, ':'); + if (colon) { + char* filename = item; + char* line = colon + 1; + *colon = '\0'; + dstr base; + d_basename(filename, NULL, base); + d_printf("* [%s](%s)\n", + base, + example_source(buffer, filename, line)); + } + } + d_print(""); + } + strcpy(current_api, ""); + } +} + +/* Local Variables: */ +/* c-basic-offset: 3 */ +/* indent-tabs-mode: nil */ +/* End: */ + /* vim: set sts=3 sw=3 et: */ diff --git a/docs/scripts/scan_examples.c b/docs/scripts/scan_examples.c new file mode 100644 index 0000000000..e090ea1368 --- /dev/null +++ b/docs/scripts/scan_examples.c @@ -0,0 +1,239 @@ +/* + * scan_examples OPTIONS EXAMPLE-FILES + * + * Load a prototypes file containing API elements + * and scan files for examples using those elements + * Output is to standard output and comprises lines + * of the form "API: FILE:LINE FILE:LINE FILE:LINE" + * No more than 3 examples will be output for each + * API. + * + * Options are: + * --protos PROTOS-FILE + * + * It is possible to use a response file to specify + * options or files. Including @FILENAME on the + * command line will read that file line-by-line + * and insert each line as if it were specified on + * the command line. This is to avoid very long + * command lines. + */ +#include +#include +#include +#include "dawk.h" + +#define SL_INITIAL_CAPACITY 64 +#define EXAMPLES_PER_API 3 + +static dstr protos; + +typedef struct { + char **items; + int count; + int capacity; +} slist_t; + +static void sl_init(slist_t *); +static void sl_free(slist_t *); +static void sl_clear(slist_t *); +static void sl_append(slist_t *, const char *); + +static void cleanup(void); +static void load_api_list(void); +static slist_t apis; + +static char **responsefile(int* pargc, char **argv); + + +/* Table of which APIs are in which examples */ +static int *table; +/* Lookup to index the best examples */ +typedef struct { + /* Index into table */ + int index; + /* How many APIs are used in each example */ + int count; +} lookup_t; +static lookup_t *lookup; +static int compare(const void *pa, const void *pb) { + return ((const lookup_t *) pa)->count - ((const lookup_t *) pb)->count; +} + +int main(int argc, char* argv[]) +{ + dstr line; + int i, j; + argv = responsefile(&argc, argv); + /* Handle --protos flag */ + if (argc >=3 && strcmp(argv[1], "--protos") == 0) { + strcpy(protos, argv[2]); + argc -= 2; + memmove(&argv[1], &argv[3], argc * sizeof(char*)); + } else { + strcpy(protos, "protos"); + } + d_cleanup = cleanup; + sl_init(&apis); + load_api_list(); + table = calloc(apis.count * argc, sizeof(int)); + + lookup = calloc(argc, sizeof(lookup_t)); + for (j = 0; j < argc; ++j) { + lookup[j].index = j; + } + + + for (j = 1; j < argc; ++j) { + d_open_input(argv[j]); + while (d_getline(line)) { + for (i = 0; i < apis.count; ++i) { + if (strstr(line, apis.items[i])) { + int *ptr = &table[i + j * apis.count]; + if (*ptr == 0) { + *ptr = d_line_num; + ++lookup[j].count; + } + } + } + } + d_close_input(); + } + /* Sort the files */ + qsort(lookup, argc, sizeof(lookup_t), compare); + /* Output the EXAMPLES_PER_API (three) 'best' examples. + * + * The 'best' is defined as the probability of having a usage of an API in + * the set of all other API usages in the example. Effectively, this means + * that examples with fewer other APIs showcased get selected. + */ + for (i = 0; i < apis.count; ++i) { + int found = 0; + for (j = 0; j < argc && found < EXAMPLES_PER_API; ++j) { + int index = lookup[j].index; + int line_num = table[i + index * apis.count]; + if (line_num != 0) { + if (found == 0) { + d_printf("%s: ", apis.items[i]); + } + ++found; + d_printf("%s:%d ", argv[index], line_num); + } + } + if (found > 0) { + d_print("\n"); + } + } + d_cleanup(); + return 0; +} + +void cleanup(void) +{ + free(table); + free(lookup); + sl_free(&apis); +} + +void sl_init(slist_t* s) +{ + s->items = NULL; + s->count = s->capacity = 0; +} + +void sl_append(slist_t *s, const char *item) +{ + if (s->count == s->capacity) { + int capacity = s->capacity == 0 ? SL_INITIAL_CAPACITY : (s->capacity * 2); + s->items = realloc(s->items, capacity * sizeof(char*)); + s->capacity = capacity; + } + s->items[s->count++] = strcpy(malloc(1+strlen(item)), item); +} + +void sl_free(slist_t *s) +{ + sl_clear(s); + free(s->items); + s->items = NULL; + s->capacity = 0; +} + +void sl_clear(slist_t *s) +{ + int i; + for (i = 0; i < s->count; ++i) { + free(s->items[i]); + } + s->count = 0; +} + +void load_api_list(void) +{ + dstr line; + d_open_input(protos); + while (d_getline(line)) { + int i; + bool found = false; + char *ptr = strchr(line, ':'); + if (ptr) { + *ptr = '\0'; + for (i = apis.count - 1; i >=0; --i) { + if (strcmp(line, apis.items[i]) == 0) { + found = true; + break; + } + } + } + if (!found) { + sl_append(&apis, line); + } + } + d_close_input(); +} + +/* Re-process the command line args by loading any response files */ +char **responsefile(int *pargc, char **argv) +{ + static slist_t args; + static char** new_argv; + int argc = *pargc; + int i; + bool found_at = false; + for (i = 1; i < argc; ++i) { + if (*argv[i] == '@') { + found_at = true; + break; + } + } + if (!found_at) { + /* Nothing to do */ + return argv; + } + sl_clear(&args); + for (i = 0; i < argc; ++i) { + if (*argv[i] == '@') { + d_open_input(argv[i] + 1); + dstr line; + while (d_getline(line)) { + sl_append(&args, line); + } + d_close_input(); + } else { + sl_append(&args, argv[i]); + } + } + /* Make a copy because code might alter the argv array */ + new_argv = realloc(new_argv, args.count * sizeof(char*)); + memcpy(new_argv, args.items, args.count * sizeof(char*)); + *pargc = args.count; + return new_argv; +} + + + +/* Local Variables: */ +/* c-basic-offset: 3 */ +/* indent-tabs-mode: nil */ +/* End: */ +/* vim: set sts=3 sw=3 et: */ diff --git a/docs/src/autosuggest.js b/docs/src/autosuggest.js index a23479f157..97f84491ff 100644 --- a/docs/src/autosuggest.js +++ b/docs/src/autosuggest.js @@ -143,10 +143,51 @@ autosuggest.prototype = { this.addEvent(this.field, "focus", callLater(this.setupEvents, this)); this.addEvent(window, "resize", callLater(this.reposition, this)); + + var obj = this; + this.addEvent(document, "keypress", function(event) { obj.funcShortcut(obj, event); }); + this.addEvent(document, "keydown", function(event) { obj.funcShortcut(obj, event); }); return this; }, + funcShortcut: function(obj, event) + { + event = event || window.event; + + var s; + if("key" in event && typeof event.key != "undefined") + { + s = event.key; + } + else + { + var c = event.charCode || event.keyCode; + if(c == 27) + { + s = "Escape"; + } + else + { + s = String.fromCharCode(c); + } + } + switch(s) + { + case "Escape": + obj.field.blur(); + break; + case "s": + case "S": + if(!this.evsetup) + { + event.preventDefault(); + obj.field.focus(); + break; + } + } + }, + bindArray: function(array) { if(!array || !array.length) return; diff --git a/docs/src/changes-5.2.txt b/docs/src/changes-5.2.txt index de7d2c47eb..a5dbd1d62d 100644 --- a/docs/src/changes-5.2.txt +++ b/docs/src/changes-5.2.txt @@ -2,6 +2,131 @@ These lists serve as summaries; the full histories are in the git repository. +Changes from 5.2.6 to 5.2.7 (March 2021) +======================================== + +The main developers this time were: SiegeLord, Peter Hull, Elias Pschernig, +Aldrik Ramaekers, Andreas Rönnquist. + +Build system: + +- Allow generating projects with a suffix (lorry-lee). + +- Fix build under Clang-CL in Visual Studio. + +Core: + +- Avoid some undefined behavior errors. + +- Return key modifiers in `ALLEGRO_EVENT_KEY_UP` and `ALLEGRO_EVENT_KEY_DOWN`. + +- Allow calling `al_map_*` color functions before Allegro is initialized. + +- Allow minimum bitmap size to be something other than 16 on non-Android + platforms (controlled via `allegro5.cfg`). + +- Add `al_get_monitor_refresh_rate` (only implemented on Windows for now). + +Graphics: + +- Fix `ALLEGRO_KEEP_INDEX` flag for bitmaps. + +- Add `ALLEGRO_OPENGL_CORE_PROFILE` display flag. + +Emscripten: + +- The experimental Emscripten support (via the SDL backend) is now documented + in `README_sdl.txt`. + +OSX: + +- Move more Cocoa operations to the main thread. + +- Explicitly link CoreVideo to fix the static build. + +Windows: + +- Issue #1125: Speed up OpenGL extension detection (Tobias Scheuer). + +- Use Unicode APIs when enumerating joysticks. + +- Use `WM_DEVICECHANGE` rather than polling to detect joystick hotlugging, + reducing input drops and lags (Todd Cope). + +- Fix joystick polling period. + +- Restore WinXP compatibility by using slightly older API when loading shared + libraries (Julian Smythe). + +- Fix build with HLSL disabled (Julian Smythe). + +- Raise DirectInput `MAX_JOYSTICKS` to 32 and `DEVICE_BUFFER_SIZE` to 128. + +SDL: + +- Issue #1224: Fix bug in SDL voice driver. + +Audio addon: + +- Allows playing sounds in reverse by specifying a negative speed. + +Acodec addon: + +- Fix edge-case looping in Ogg Vorbis stream (Cody Licorish) + +Audio addon: + +- Use more sensible values for PulseAudio's playback buffer, potentially + resolving some crashes and high CPU usage. + +Native Dialog Addon: + +- Migrate from GTK2 to GTK3. Sadly, we lose menu icons as GTK3 dropped support + for them. + +TTF addon: + +- Allow initializing TTF addon before the Font addon. + +- Shut-down the TTF addon automatically in `al_uninstall_system`. + +PhysFS addon: + +- Fix handling of native path separators. + +- Stop using deprecated PhysFS API. + +Primitives addon: + +- Fix segfault in `al_draw_ribbon` when `num_segments > 128` (Rodolfo Borges). + +- Issue 1215: Correctly handle small scales when determining subdivision level + for high level primitives (Robin Heydon). + +Documentation: + +- Fix LaTeX errors in the generation of the reference manual PDF. + +- Add links to examples into the reference manual. + +- Allow pressing 'S' to focus the search bar in the docs. + +- Assorted documentation improvements. + +Misc: + +- Add a security policy and an associated private security mailing list - + allegro-security@lists.liballeg.org. + +- Add Emscripten-powered examples to https://liballeg.org/examples_demos.html. + +Examples: + +- `ex_audio_simple` now displays instructions and supports bidirectional looping. + +- Add default files to some audio examples. + + Changes from 5.2.5 to 5.2.6 (February 2020) ========================================== diff --git a/docs/src/pandoc.css b/docs/src/pandoc.css index aac526db05..ff4b481714 100644 --- a/docs/src/pandoc.css +++ b/docs/src/pandoc.css @@ -145,7 +145,7 @@ div.searchbox { /* font-size isn't inherited (at least not in Firefox and Chrome) */ input#q { font-size: small; - width: 95%; /* fix searchfield being wider than sidebar */ + width: 85%; } /* Body of page */ @@ -199,7 +199,7 @@ p.timestamp { .autosuggest-body table { width: 100%; - background-color: #FFFFF0; + background-color: #f3f3fa; } .autosuggest-body tr diff --git a/docs/src/refman/color.txt b/docs/src/refman/color.txt index 18c50c66ce..d707604539 100644 --- a/docs/src/refman/color.txt +++ b/docs/src/refman/color.txt @@ -405,7 +405,7 @@ Since: 5.2.3 See also: [al_color_lch], [al_color_rgb_to_lch] -## API: al_color_distance_ciede2000_lab +## API: al_color_distance_ciede2000 This function computes the CIEDE2000 color difference between two RGB colors. This is a visually uniform color difference, unlike for diff --git a/docs/src/refman/display.txt b/docs/src/refman/display.txt index 649e9324db..b0c36c671e 100644 --- a/docs/src/refman/display.txt +++ b/docs/src/refman/display.txt @@ -160,6 +160,13 @@ ALLEGRO_OPENGL_ES_PROFILE Note: Currently this is only supported by the X11/GLX driver. Since: 5.1.13 +ALLEGRO_OPENGL_CORE_PROFILE +: Used together with ALLEGRO_OPENGL, requests that the OpenGL context + uses the OpenGL Core profile. A specific version can be requested + with [al_set_new_display_option]. + Note: Currently this is only supported by the X11/GLX driver. + Since: 5.2.7 + ALLEGRO_DIRECT3D : Require the driver to do rendering with Direct3D and provide a Direct3D device. diff --git a/docs/src/refman/graphics.txt b/docs/src/refman/graphics.txt index 9c418d6bb7..d1b9e0ceb6 100644 --- a/docs/src/refman/graphics.txt +++ b/docs/src/refman/graphics.txt @@ -19,6 +19,8 @@ translate from and to various color representations. Convert r, g, b (ranging from 0-255) into an [ALLEGRO_COLOR], using 255 for alpha. +This function can be called before Allegro is initialized. + See also: [al_map_rgba], [al_map_rgba_f], [al_map_rgb_f] ### API: al_map_rgb_f @@ -26,12 +28,16 @@ See also: [al_map_rgba], [al_map_rgba_f], [al_map_rgb_f] Convert r, g, b, (ranging from 0.0f-1.0f) into an [ALLEGRO_COLOR], using 1.0f for alpha. +This function can be called before Allegro is initialized. + See also: [al_map_rgba], [al_map_rgb], [al_map_rgba_f] ### API: al_map_rgba Convert r, g, b, a (ranging from 0-255) into an [ALLEGRO_COLOR]. +This function can be called before Allegro is initialized. + See also: [al_map_rgb], [al_premul_rgba], [al_map_rgb_f] ### API: al_premul_rgba @@ -54,6 +60,8 @@ ALLEGRO_COLOR c = al_premul_rgba(r, g, b, a); al_draw_tinted_bitmap(bmp, c, 0, 0, 0); ~~~~ +This function can be called before Allegro is initialized. + Since: 5.1.12 See also: [al_map_rgba], [al_premul_rgba_f] @@ -62,6 +70,8 @@ See also: [al_map_rgba], [al_premul_rgba_f] Convert r, g, b, a (ranging from 0.0f-1.0f) into an [ALLEGRO_COLOR]. +This function can be called before Allegro is initialized. + See also: [al_map_rgba], [al_premul_rgba_f], [al_map_rgb_f] ### API: al_premul_rgba_f @@ -84,6 +94,8 @@ ALLEGRO_COLOR c = al_premul_rgba_f(r, g, b, a); al_draw_tinted_bitmap(bmp, c, 0, 0, 0); ~~~~ +This function can be called before Allegro is initialized. + Since: 5.1.12 See also: [al_map_rgba_f], [al_premul_rgba] @@ -93,6 +105,8 @@ See also: [al_map_rgba_f], [al_premul_rgba] Retrieves components of an ALLEGRO_COLOR, ignoring alpha. Components will range from 0-255. +This function can be called before Allegro is initialized. + See also: [al_unmap_rgba], [al_unmap_rgba_f], [al_unmap_rgb_f] ### API: al_unmap_rgb_f @@ -100,6 +114,8 @@ See also: [al_unmap_rgba], [al_unmap_rgba_f], [al_unmap_rgb_f] Retrieves components of an [ALLEGRO_COLOR], ignoring alpha. Components will range from 0.0f-1.0f. +This function can be called before Allegro is initialized. + See also: [al_unmap_rgba], [al_unmap_rgb], [al_unmap_rgba_f] ### API: al_unmap_rgba @@ -107,6 +123,8 @@ See also: [al_unmap_rgba], [al_unmap_rgb], [al_unmap_rgba_f] Retrieves components of an [ALLEGRO_COLOR]. Components will range from 0-255. +This function can be called before Allegro is initialized. + See also: [al_unmap_rgb], [al_unmap_rgba_f], [al_unmap_rgb_f] ### API: al_unmap_rgba_f @@ -114,6 +132,8 @@ See also: [al_unmap_rgb], [al_unmap_rgba_f], [al_unmap_rgb_f] Retrieves components of an [ALLEGRO_COLOR]. Components will range from 0.0f-1.0f. +This function can be called before Allegro is initialized. + See also: [al_unmap_rgba], [al_unmap_rgb], [al_unmap_rgb_f] @@ -436,7 +456,9 @@ relevant if you plan to use this bitmap with the primitives addon. If you try to create a bitmap smaller than this, this call will not fail but the returned bitmap will be a section of a larger bitmap with the minimum size. The minimum size that will work on all platforms is 32 by -32. +32. There is an experimental switch to turns this padding off by editing +the system configuration (see `min_bitmap_size` key in +[al_get_system_config]). Some platforms do not directly support display bitmaps whose dimensions are not powers of two. Allegro handles this by creating a larger bitmap diff --git a/docs/src/refman/inc.a.txt b/docs/src/refman/inc.a.txt index 58cb51ac6d..f1bb4c7210 100644 --- a/docs/src/refman/inc.a.txt +++ b/docs/src/refman/inc.a.txt @@ -71,7 +71,7 @@ function on_search(index, control) { } Search
-
+
diff --git a/docs/src/refman/monitor.txt b/docs/src/refman/monitor.txt index 3de50bd574..5f911e892a 100644 --- a/docs/src/refman/monitor.txt +++ b/docs/src/refman/monitor.txt @@ -79,3 +79,13 @@ On Windows, use [al_set_new_display_flags] to switch between Direct3D and OpenGL backends, which will often have different adapters available. See also: [al_get_monitor_info] + +## API: al_get_monitor_refresh_rate + +Returns the current refresh rate of a monitor attached to the display adapter. + +Since: 5.2.6 + +> *[Unstable API]:* This is an experimental feature and currently only works on Windows. + +See also: [al_get_monitor_info] diff --git a/examples/ex_acodec_multi.c b/examples/ex_acodec_multi.c index 41f39c435c..1b88c3c7e5 100644 --- a/examples/ex_acodec_multi.c +++ b/examples/ex_acodec_multi.c @@ -11,6 +11,10 @@ #include "common.c" +char *default_files[] = {NULL, "data/welcome.voc", + "data/haiku/earth_0.ogg", "data/haiku/water_0.ogg", + "data/haiku/fire_0.ogg", "data/haiku/air_0.ogg"}; + int main(int argc, char **argv) { int i; @@ -27,8 +31,9 @@ int main(int argc, char **argv) open_log(); if (argc < 2) { - log_printf("This example needs to be run from the command line.\nUsage: %s {audio_files}\n", argv[0]); - goto done; + log_printf("This example can be run from the command line.\nUsage: %s {audio_files}\n", argv[0]); + argv = default_files; + argc = 6; } al_init_acodec_addon(); @@ -128,7 +133,6 @@ int main(int argc, char **argv) al_uninstall_audio(); -done: close_log(true); return 0; diff --git a/examples/ex_audio_simple.c b/examples/ex_audio_simple.c index e4467e3ed1..de4cbef902 100644 --- a/examples/ex_audio_simple.c +++ b/examples/ex_audio_simple.c @@ -17,6 +17,13 @@ #define RESERVED_SAMPLES 16 #define MAX_SAMPLE_DATA 10 +const char *default_files[] = {NULL, "data/welcome.wav", + "data/haiku/fire_0.ogg", "data/haiku/fire_1.ogg", + "data/haiku/fire_2.ogg", "data/haiku/fire_3.ogg", + "data/haiku/fire_4.ogg", "data/haiku/fire_5.ogg", + "data/haiku/fire_6.ogg", "data/haiku/fire_7.ogg", + }; + int main(int argc, const char *argv[]) { ALLEGRO_SAMPLE *sample_data[MAX_SAMPLE_DATA] = {NULL}; @@ -40,8 +47,9 @@ int main(int argc, const char *argv[]) open_log(); if (argc < 2) { - log_printf("This example needs to be run from the command line.\nUsage: %s {audio_files}\n", argv[0]); - goto done; + log_printf("This example can be run from the command line.\nUsage: %s {audio_files}\n", argv[0]); + argv = default_files; + argc = 10; } argc--; argv++; @@ -227,7 +235,6 @@ int main(int argc, const char *argv[]) /* Sample data and other objects will be automatically freed. */ al_uninstall_audio(); -done: al_destroy_display(display); close_log(true); return 0; diff --git a/examples/ex_audio_timer.c b/examples/ex_audio_timer.c index edde90157a..b07971fc06 100644 --- a/examples/ex_audio_timer.c +++ b/examples/ex_audio_timer.c @@ -117,6 +117,7 @@ int main(int argc, char **argv) event_queue = al_create_event_queue(); al_register_event_source(event_queue, al_get_keyboard_event_source()); al_register_event_source(event_queue, al_get_timer_event_source(timer)); + al_register_event_source(event_queue, al_get_display_event_source(display)); al_identity_transform(&trans); al_scale_transform(&trans, 16.0, 16.0); @@ -151,6 +152,9 @@ int main(int argc, char **argv) } } } + else if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + break; + } if (redraw && al_is_event_queue_empty(event_queue)) { ALLEGRO_COLOR c; diff --git a/examples/ex_kcm_direct.c b/examples/ex_kcm_direct.c index d9447c2241..938679f59e 100644 --- a/examples/ex_kcm_direct.c +++ b/examples/ex_kcm_direct.c @@ -7,6 +7,8 @@ #include "common.c" +char *default_files[] = {NULL, "data/welcome.wav"}; + int main(int argc, char **argv) { ALLEGRO_VOICE *voice; @@ -20,8 +22,9 @@ int main(int argc, char **argv) open_log(); if (argc < 2) { - log_printf("This example needs to be run from the command line.\nUsage: %s {audio_files}\n", argv[0]); - goto done; + log_printf("This example can be run from the command line.\nUsage: %s {audio_files}\n", argv[0]); + argv = default_files; + argc = 2; } al_init_acodec_addon(); @@ -93,7 +96,6 @@ int main(int argc, char **argv) } al_uninstall_audio(); -done: close_log(true); return 0; diff --git a/examples/ex_mixer_chain.c b/examples/ex_mixer_chain.c index 103996457c..628e23a4c8 100644 --- a/examples/ex_mixer_chain.c +++ b/examples/ex_mixer_chain.c @@ -11,6 +11,9 @@ #include "common.c" +char *default_files[] = {NULL, "data/haiku/water_0.ogg", + "data/haiku/water_7.ogg"}; + int main(int argc, char **argv) { ALLEGRO_VOICE *voice; @@ -29,8 +32,9 @@ int main(int argc, char **argv) open_log(); if (argc < 3) { - log_printf("This example needs to be run from the command line.\nUsage: %s file1 file2\n", argv[0]); - goto done; + log_printf("This example can be run from the command line.\nUsage: %s file1 file2\n", argv[0]); + argv = default_files; + argc = 3; } al_init_acodec_addon(); @@ -117,7 +121,6 @@ int main(int argc, char **argv) al_uninstall_audio(); -done: close_log(true); return 0; diff --git a/examples/ex_stream_file.c b/examples/ex_stream_file.c index 1226144703..b6485e7087 100644 --- a/examples/ex_stream_file.c +++ b/examples/ex_stream_file.c @@ -20,6 +20,8 @@ */ //#define BYPASS_MIXER +char *default_files[] = {NULL, "../demos/skater/data/menu/skate2.ogg"}; + int main(int argc, char **argv) { int i; @@ -35,9 +37,10 @@ int main(int argc, char **argv) open_log(); if (argc < 2) { - log_printf("This example needs to be run from the command line.\n"); + log_printf("This example can be run from the command line.\n"); log_printf("Usage: %s [--loop] {audio_files}\n", argv[0]); - goto done; + argv = default_files; + argc = 2; } if (strcmp(argv[1], "--loop") == 0) { @@ -80,6 +83,12 @@ int main(int argc, char **argv) ALLEGRO_EVENT_QUEUE* queue = al_create_event_queue(); stream = al_load_audio_stream(filename, 4, 2048); + if (!stream) { + /* If it is not packed, e.g. on Android or iOS. */ + if (!strcmp(filename, default_files[1])) { + stream = al_load_audio_stream("data/welcome.wav", 4, 2048); + } + } if (!stream) { log_printf("Could not create an ALLEGRO_AUDIO_STREAM from '%s'!\n", filename); @@ -122,7 +131,6 @@ int main(int argc, char **argv) al_destroy_voice(voice); al_uninstall_audio(); -done: close_log(true); return 0; diff --git a/include/allegro5/base.h b/include/allegro5/base.h index 1e3bdedaba..46417bdaec 100644 --- a/include/allegro5/base.h +++ b/include/allegro5/base.h @@ -55,7 +55,7 @@ #define ALLEGRO_VERSION 5 #define ALLEGRO_SUB_VERSION 2 -#define ALLEGRO_WIP_VERSION 7 +#define ALLEGRO_WIP_VERSION 8 #ifdef ALLEGRO_UNSTABLE /* 1 << 31 represented as a signed int to match the arg type of @@ -76,9 +76,9 @@ */ #define ALLEGRO_RELEASE_NUMBER 0 -#define ALLEGRO_VERSION_STR "5.2.7 (GIT)" -#define ALLEGRO_DATE_STR "2020" -#define ALLEGRO_DATE 20200207 /* yyyymmdd */ +#define ALLEGRO_VERSION_STR "5.2.8 (GIT)" +#define ALLEGRO_DATE_STR "2021" +#define ALLEGRO_DATE 20210307 /* yyyymmdd */ #define ALLEGRO_VERSION_INT \ ((ALLEGRO_VERSION << 24) | (ALLEGRO_SUB_VERSION << 16) | \ (ALLEGRO_WIP_VERSION << 8) | ALLEGRO_RELEASE_NUMBER | \ diff --git a/include/allegro5/display.h b/include/allegro5/display.h index 84a9ccfeb1..2b8c8798bd 100644 --- a/include/allegro5/display.h +++ b/include/allegro5/display.h @@ -27,6 +27,9 @@ enum { ALLEGRO_GTK_TOPLEVEL_INTERNAL = 1 << 12, ALLEGRO_MAXIMIZED = 1 << 13, ALLEGRO_OPENGL_ES_PROFILE = 1 << 14, +#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_SRC) + ALLEGRO_OPENGL_CORE_PROFILE = 1 << 15, +#endif }; /* Possible parameters for al_set_display_option. diff --git a/include/allegro5/internal/aintern_pixels.h b/include/allegro5/internal/aintern_pixels.h index 3ad0e37dc5..e85f7096e7 100644 --- a/include/allegro5/internal/aintern_pixels.h +++ b/include/allegro5/internal/aintern_pixels.h @@ -487,7 +487,6 @@ AL_ARRAY(int, _al_rgb_scale_5); AL_ARRAY(int, _al_rgb_scale_6); AL_ARRAY(float, _al_u8_to_float); -AL_FUNC(void, _al_init_pixels, (void)); AL_FUNC(bool, _al_pixel_format_has_alpha, (int format)); AL_FUNC(bool, _al_pixel_format_is_real, (int format)); AL_FUNC(bool, _al_pixel_format_is_video_only, (int format)); diff --git a/include/allegro5/internal/aintern_system.h b/include/allegro5/internal/aintern_system.h index b5051b446d..01d6a36f4c 100644 --- a/include/allegro5/internal/aintern_system.h +++ b/include/allegro5/internal/aintern_system.h @@ -33,6 +33,7 @@ struct ALLEGRO_SYSTEM_INTERFACE void (*shutdown_system)(void); int (*get_num_video_adapters)(void); bool (*get_monitor_info)(int adapter, ALLEGRO_MONITOR_INFO *info); + int (*get_monitor_refresh_rate)(int adapter); int (*get_monitor_dpi)(int adapter); ALLEGRO_MOUSE_CURSOR *(*create_mouse_cursor)(ALLEGRO_BITMAP *bmp, int x_focus, int y_focus); void (*destroy_mouse_cursor)(ALLEGRO_MOUSE_CURSOR *cursor); @@ -59,6 +60,7 @@ struct ALLEGRO_SYSTEM _AL_VECTOR displays; /* Keep a list of all displays attached to us. */ ALLEGRO_PATH *user_exe_path; int mouse_wheel_precision; + int min_bitmap_size; bool installed; }; diff --git a/include/allegro5/monitor.h b/include/allegro5/monitor.h index 8887b1dc05..efa1c975e3 100644 --- a/include/allegro5/monitor.h +++ b/include/allegro5/monitor.h @@ -25,7 +25,9 @@ enum { AL_FUNC(int, al_get_num_video_adapters, (void)); AL_FUNC(bool, al_get_monitor_info, (int adapter, ALLEGRO_MONITOR_INFO *info)); AL_FUNC(int, al_get_monitor_dpi, (int adapter)); - +#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_SRC) +AL_FUNC(int, al_get_monitor_refresh_rate, (int adapter)); +#endif #ifdef __cplusplus } diff --git a/include/allegro5/platform/alplatf.h.cmake b/include/allegro5/platform/alplatf.h.cmake index b19a72fa4d..a5cfcf822d 100644 --- a/include/allegro5/platform/alplatf.h.cmake +++ b/include/allegro5/platform/alplatf.h.cmake @@ -120,5 +120,8 @@ /* Define if we are building with SDL backend. */ #cmakedefine ALLEGRO_SDL +/* Define if sleep should be used instead of threads (only useful for emscripten without web workers) */ +#cmakedefine ALLEGRO_WAIT_EVENT_SLEEP + /*---------------------------------------------------------------------------*/ /* vi: set ft=c ts=3 sts=3 sw=3 et: */ diff --git a/misc/make_pixel_tables.py b/misc/make_pixel_tables.py new file mode 100755 index 0000000000..2723d15942 --- /dev/null +++ b/misc/make_pixel_tables.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +import optparse, sys + +def main(argv): + p = optparse.OptionParser() + p.description = ("When run from the toplevel A5 folder, this will " + "re-create the src/pixel_tables.inc.""") + p.parse_args() + + with open("src/pixel_tables.inc", "w") as f: + f.write("""// Warning: This file was created by make_pixel_tables.py - do not edit. + +"""); + + f.write("float _al_u8_to_float[] = {\n") + for i in range(256): + f.write(f" {i / 255.0},\n") + f.write("};\n\n") + + f.write("int _al_rgb_scale_1[] = {\n") + for i in range(2): + f.write(f" {i * 255 // 1},\n") + f.write("};\n\n") + + f.write("int _al_rgb_scale_4[] = {\n") + for i in range(16): + f.write(f" {i * 255 // 15},\n") + f.write("};\n\n") + + f.write("int _al_rgb_scale_5[] = {\n") + for i in range(32): + f.write(f" {i * 255 // 31},\n") + f.write("};\n\n") + + f.write("int _al_rgb_scale_6[] = {\n") + for i in range(64): + f.write(f" {i * 255 // 63},\n") + f.write("};\n\n") + + f.write("""// Warning: This file was created by make_pixel_tables.py - do not edit. +"""); + +if __name__ == "__main__": + main(sys.argv) diff --git a/src/debug.c b/src/debug.c index 1ad0d1a6a8..6820d4c65f 100644 --- a/src/debug.c +++ b/src/debug.c @@ -176,7 +176,7 @@ static void open_trace_file(void) if (s) trace_info.trace_file = fopen(s, "w"); else -#if defined(ALLEGRO_IPHONE) || defined(ALLEGRO_ANDROID) +#if defined(ALLEGRO_IPHONE) || defined(ALLEGRO_ANDROID) || defined(__EMSCRIPTEN__) /* iPhone and Android don't like us writing files, so we'll be doing * something else there by default. */ trace_info.trace_file = NULL; @@ -299,37 +299,35 @@ void _al_trace_suffix(const char *msg, ...) if (_al_user_trace_handler) { _al_user_trace_handler(static_trace_buffer); - static_trace_buffer[0] = '\0'; - return; } - + else { #ifdef ALLEGRO_ANDROID - (void)__android_log_print(ANDROID_LOG_INFO, "allegro", "%s", - static_trace_buffer); + (void)__android_log_print(ANDROID_LOG_INFO, "allegro", "%s", + static_trace_buffer); #endif -#ifdef ALLEGRO_IPHONE - fprintf(stderr, "%s", static_trace_buffer); - fflush(stderr); +#if defined(ALLEGRO_IPHONE) || defined(__EMSCRIPTEN__) + fprintf(stderr, "%s", static_trace_buffer); + fflush(stderr); #endif #ifdef ALLEGRO_WINDOWS - { - TCHAR *windows_output = _twin_utf8_to_tchar(static_trace_buffer); - OutputDebugString(windows_output); - al_free(windows_output); - } + { + TCHAR *windows_output = _twin_utf8_to_tchar(static_trace_buffer); + OutputDebugString(windows_output); + al_free(windows_output); + } #endif - /* We're intentially still writing to a file if it's set even with the - * additional logging options above. */ - if (trace_info.trace_file) { - fprintf(trace_info.trace_file, "%s", static_trace_buffer); - fflush(trace_info.trace_file); + /* We're intentially still writing to a file if it's set even with the + * additional logging options above. */ + if (trace_info.trace_file) { + fprintf(trace_info.trace_file, "%s", static_trace_buffer); + fflush(trace_info.trace_file); + } } static_trace_buffer[0] = '\0'; + errno = olderr; _al_mutex_unlock(&trace_info.trace_mutex); - - errno = olderr; } diff --git a/src/events.c b/src/events.c index bb53dd81c3..fc44171f5f 100644 --- a/src/events.c +++ b/src/events.c @@ -403,7 +403,12 @@ void al_wait_for_event(ALLEGRO_EVENT_QUEUE *queue, ALLEGRO_EVENT *ret_event) _al_mutex_lock(&queue->mutex); { while (is_event_queue_empty(queue)) { + #ifdef ALLEGRO_WAIT_EVENT_SLEEP + al_rest(0.001); + heartbeat(); + #else _al_cond_wait(&queue->cond, &queue->mutex); + #endif } if (ret_event) { diff --git a/src/linux/lhaptic.c b/src/linux/lhaptic.c index 271470955d..17bb305990 100644 --- a/src/linux/lhaptic.c +++ b/src/linux/lhaptic.c @@ -96,6 +96,8 @@ static bool lhap_release_effect(ALLEGRO_HAPTIC_EFFECT_ID *id); static double lhap_get_autocenter(ALLEGRO_HAPTIC *dev); static bool lhap_set_autocenter(ALLEGRO_HAPTIC *dev, double); +static void lhap_timerclear(struct input_event *evt); + ALLEGRO_HAPTIC_DRIVER _al_hapdrv_linux = { _ALLEGRO_HAPDRV_LINUX, @@ -131,7 +133,7 @@ ALLEGRO_HAPTIC_DRIVER _al_hapdrv_linux = lhap_release_effect, lhap_release, - + lhap_get_autocenter, lhap_set_autocenter }; @@ -608,11 +610,11 @@ static double lhap_get_gain(ALLEGRO_HAPTIC *dev) { ALLEGRO_HAPTIC_LINUX *lhap = lhap_from_al(dev); (void)dev; - - if(!al_is_haptic_capable(dev, ALLEGRO_HAPTIC_GAIN)) { - return 0.0; - } - + + if(!al_is_haptic_capable(dev, ALLEGRO_HAPTIC_GAIN)) { + return 0.0; + } + /* Unfortunately there seems to be no API to GET gain, only to set?! * So, return the stored gain. */ @@ -626,7 +628,7 @@ static bool lhap_set_gain(ALLEGRO_HAPTIC *dev, double gain) struct input_event ie; lhap->parent.gain = gain; - timerclear(&ie.time); + lhap_timerclear(&ie); ie.type = EV_FF; ie.code = FF_GAIN; ie.value = (__s32) ((double)0xFFFF * gain); @@ -643,7 +645,7 @@ static bool lhap_set_autocenter(ALLEGRO_HAPTIC *dev, double autocenter) struct input_event ie; lhap->parent.autocenter = autocenter; - timerclear(&ie.time); + lhap_timerclear(&ie); ie.type = EV_FF; ie.code = FF_AUTOCENTER; ie.value = (__s32) ((double)0xFFFF * autocenter); @@ -657,8 +659,8 @@ static double lhap_get_autocenter(ALLEGRO_HAPTIC *dev) { ALLEGRO_HAPTIC_LINUX *lhap = lhap_from_al(dev); (void)dev; - - if(!al_is_haptic_capable(dev, ALLEGRO_HAPTIC_AUTOCENTER)) { + + if(!al_is_haptic_capable(dev, ALLEGRO_HAPTIC_AUTOCENTER)) { return 0.0; } @@ -769,7 +771,7 @@ static bool lhap_play_effect(ALLEGRO_HAPTIC_EFFECT_ID *id, int loops) fd = lhap->fd; - timerclear(&play.time); + lhap_timerclear(&play); play.type = EV_FF; play.code = id->_handle; loops = (loops < 0) ? 1 : loops; @@ -852,6 +854,11 @@ static bool lhap_release(ALLEGRO_HAPTIC *haptic) return true; } +void lhap_timerclear(struct input_event* evt) +{ + evt->input_event_sec = 0; + evt->input_event_usec = 0; +} #endif /* ALLEGRO_HAVE_LINUX_INPUT_H */ diff --git a/src/monitor.c b/src/monitor.c index 4e8b9a9bfc..39a987f952 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -31,6 +31,21 @@ int al_get_num_video_adapters(void) return 0; } +/* Function: al_get_monitor_refresh_rate + */ +int al_get_monitor_refresh_rate(int adapter) +{ + ALLEGRO_SYSTEM *system = al_get_system_driver(); + + if (adapter < al_get_num_video_adapters()) { + if (system && system->vt && system->vt->get_monitor_refresh_rate) { + return system->vt->get_monitor_refresh_rate(adapter); + } + } + + return 0; +} + /* Function: al_get_monitor_info */ diff --git a/src/opengl/ogl_bitmap.c b/src/opengl/ogl_bitmap.c index 306555c42a..2d6dc19bcd 100644 --- a/src/opengl/ogl_bitmap.c +++ b/src/opengl/ogl_bitmap.c @@ -780,10 +780,9 @@ static ALLEGRO_LOCKED_REGION *ogl_lock_compressed_region(ALLEGRO_BITMAP *bitmap, * See also pitfalls 7 & 8 from: * http://www.opengl.org/resources/features/KilgardTechniques/oglpitfall/ */ -#ifdef GL_CLIENT_PIXEL_STORE_BIT - glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); -#endif - { + int previous_alignment; + glGetIntegerv(GL_PACK_ALIGNMENT, &previous_alignment); + if (previous_alignment != 1) { glPixelStorei(GL_PACK_ALIGNMENT, 1); e = glGetError(); if (e) { @@ -842,9 +841,9 @@ static ALLEGRO_LOCKED_REGION *ogl_lock_compressed_region(ALLEGRO_BITMAP *bitmap, } } -#ifdef GL_CLIENT_PIXEL_STORE_BIT - glPopClientAttrib(); -#endif + if (previous_alignment != 1) { + glPixelStorei(GL_PACK_ALIGNMENT, previous_alignment); + } if (old_disp != NULL) { _al_set_current_display_only(old_disp); @@ -908,10 +907,9 @@ static void ogl_unlock_compressed_region(ALLEGRO_BITMAP *bitmap) } /* Keep this in sync with ogl_lock_compressed_region. */ -#ifdef GL_CLIENT_PIXEL_STORE_BIT - glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); -#endif - { + int previous_alignment; + glGetIntegerv(GL_UNPACK_ALIGNMENT, &previous_alignment); + if (previous_alignment != 1) { glPixelStorei(GL_UNPACK_ALIGNMENT, 1); e = glGetError(); if (e) { @@ -934,9 +932,9 @@ static void ogl_unlock_compressed_region(ALLEGRO_BITMAP *bitmap) _al_pixel_format_name(lock_format), _al_gl_error_string(e)); } -#ifdef GL_CLIENT_PIXEL_STORE_BIT - glPopClientAttrib(); -#endif + if (previous_alignment != 1) { + glPixelStorei(GL_UNPACK_ALIGNMENT, previous_alignment); + } if (old_disp) { _al_set_current_display_only(old_disp); @@ -1027,6 +1025,7 @@ ALLEGRO_BITMAP *_al_ogl_create_bitmap(ALLEGRO_DISPLAY *d, int w, int h, int true_h; int block_width; int block_height; + ALLEGRO_SYSTEM *system = al_get_system_driver(); (void)d; format = _al_get_real_pixel_format(d, format); @@ -1055,8 +1054,8 @@ ALLEGRO_BITMAP *_al_ogl_create_bitmap(ALLEGRO_DISPLAY *d, int w, int h, * work with them on some of these chips. This is a * workaround. */ - if (true_w < 16) true_w = 16; - if (true_h < 16) true_h = 16; + if (true_w < system->min_bitmap_size) true_w = system->min_bitmap_size; + if (true_h < system->min_bitmap_size) true_h = system->min_bitmap_size; /* glReadPixels requires 32 byte aligned rows */ if (IS_ANDROID) { diff --git a/src/opengl/ogl_lock.c b/src/opengl/ogl_lock.c index ba39f91003..4c048f6516 100644 --- a/src/opengl/ogl_lock.c +++ b/src/opengl/ogl_lock.c @@ -102,6 +102,7 @@ ALLEGRO_LOCKED_REGION *_al_ogl_lock_region_new(ALLEGRO_BITMAP *bitmap, GLenum e; bool ok; bool restore_fbo = false; + bool reset_alignment = false; if (format == ALLEGRO_PIXEL_FORMAT_ANY) { /* Never pick compressed formats with ANY, as it interacts weirdly with @@ -135,16 +136,20 @@ ALLEGRO_LOCKED_REGION *_al_ogl_lock_region_new(ALLEGRO_BITMAP *bitmap, * See also pitfalls 7 & 8 from: * http://www.opengl.org/resources/features/KilgardTechniques/oglpitfall/ */ - glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); + int previous_alignment; + glGetIntegerv(GL_PACK_ALIGNMENT, &previous_alignment); { const int pixel_size = al_get_pixel_size(format); const int pixel_alignment = ogl_pixel_alignment(pixel_size); - glPixelStorei(GL_PACK_ALIGNMENT, pixel_alignment); - e = glGetError(); - if (e) { - ALLEGRO_ERROR("glPixelStorei(GL_PACK_ALIGNMENT, %d) failed (%s).\n", - pixel_alignment, _al_gl_error_string(e)); - ok = false; + if (previous_alignment != pixel_alignment) { + reset_alignment = true; + glPixelStorei(GL_PACK_ALIGNMENT, pixel_alignment); + e = glGetError(); + if (e) { + ALLEGRO_ERROR("glPixelStorei(GL_PACK_ALIGNMENT, %d) failed (%s).\n", + pixel_alignment, _al_gl_error_string(e)); + ok = false; + } } } @@ -166,7 +171,9 @@ ALLEGRO_LOCKED_REGION *_al_ogl_lock_region_new(ALLEGRO_BITMAP *bitmap, } } - glPopClientAttrib(); + if (reset_alignment) { + glPixelStorei(GL_PACK_ALIGNMENT, previous_alignment); + } /* Restore state after switching FBO. */ if (restore_fbo) { @@ -438,6 +445,7 @@ static void ogl_unlock_region_non_readonly(ALLEGRO_BITMAP *bitmap, ALLEGRO_DISPLAY *disp; int orig_format; bool biased_alpha = false; + bool reset_alignment = false; GLenum e; disp = al_get_current_display(); @@ -453,15 +461,19 @@ static void ogl_unlock_region_non_readonly(ALLEGRO_BITMAP *bitmap, } /* Keep this in sync with ogl_lock_region. */ - glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); + int previous_alignment; + glGetIntegerv(GL_UNPACK_ALIGNMENT, &previous_alignment); { const int lock_pixel_size = al_get_pixel_size(lock_format); const int pixel_alignment = ogl_pixel_alignment(lock_pixel_size); - glPixelStorei(GL_UNPACK_ALIGNMENT, pixel_alignment); - e = glGetError(); - if (e) { - ALLEGRO_ERROR("glPixelStorei(GL_UNPACK_ALIGNMENT, %d) failed (%s).\n", - pixel_alignment, _al_gl_error_string(e)); + if (pixel_alignment != previous_alignment) { + reset_alignment = true; + glPixelStorei(GL_UNPACK_ALIGNMENT, pixel_alignment); + e = glGetError(); + if (e) { + ALLEGRO_ERROR("glPixelStorei(GL_UNPACK_ALIGNMENT, %d) failed (%s).\n", + pixel_alignment, _al_gl_error_string(e)); + } } } if (exactly_15bpp(lock_format)) { @@ -504,7 +516,9 @@ static void ogl_unlock_region_non_readonly(ALLEGRO_BITMAP *bitmap, if (biased_alpha) { glPixelTransferi(GL_ALPHA_BIAS, 0); } - glPopClientAttrib(); + if (reset_alignment) { + glPixelStorei(GL_UNPACK_ALIGNMENT, previous_alignment); + } if (old_disp) { _al_set_current_display_only(old_disp); diff --git a/src/pixel_tables.inc b/src/pixel_tables.inc new file mode 100644 index 0000000000..e70af62f3c --- /dev/null +++ b/src/pixel_tables.inc @@ -0,0 +1,388 @@ +// Warning: This file was created by make_pixel_tables.py - do not edit. + +float _al_u8_to_float[] = { + 0.0, + 0.00392156862745098, + 0.00784313725490196, + 0.011764705882352941, + 0.01568627450980392, + 0.0196078431372549, + 0.023529411764705882, + 0.027450980392156862, + 0.03137254901960784, + 0.03529411764705882, + 0.0392156862745098, + 0.043137254901960784, + 0.047058823529411764, + 0.050980392156862744, + 0.054901960784313725, + 0.058823529411764705, + 0.06274509803921569, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.08235294117647059, + 0.08627450980392157, + 0.09019607843137255, + 0.09411764705882353, + 0.09803921568627451, + 0.10196078431372549, + 0.10588235294117647, + 0.10980392156862745, + 0.11372549019607843, + 0.11764705882352941, + 0.12156862745098039, + 0.12549019607843137, + 0.12941176470588237, + 0.13333333333333333, + 0.13725490196078433, + 0.1411764705882353, + 0.1450980392156863, + 0.14901960784313725, + 0.15294117647058825, + 0.1568627450980392, + 0.1607843137254902, + 0.16470588235294117, + 0.16862745098039217, + 0.17254901960784313, + 0.17647058823529413, + 0.1803921568627451, + 0.1843137254901961, + 0.18823529411764706, + 0.19215686274509805, + 0.19607843137254902, + 0.2, + 0.20392156862745098, + 0.20784313725490197, + 0.21176470588235294, + 0.21568627450980393, + 0.2196078431372549, + 0.2235294117647059, + 0.22745098039215686, + 0.23137254901960785, + 0.23529411764705882, + 0.23921568627450981, + 0.24313725490196078, + 0.24705882352941178, + 0.25098039215686274, + 0.2549019607843137, + 0.25882352941176473, + 0.2627450980392157, + 0.26666666666666666, + 0.27058823529411763, + 0.27450980392156865, + 0.2784313725490196, + 0.2823529411764706, + 0.28627450980392155, + 0.2901960784313726, + 0.29411764705882354, + 0.2980392156862745, + 0.30196078431372547, + 0.3058823529411765, + 0.30980392156862746, + 0.3137254901960784, + 0.3176470588235294, + 0.3215686274509804, + 0.3254901960784314, + 0.32941176470588235, + 0.3333333333333333, + 0.33725490196078434, + 0.3411764705882353, + 0.34509803921568627, + 0.34901960784313724, + 0.35294117647058826, + 0.3568627450980392, + 0.3607843137254902, + 0.36470588235294116, + 0.3686274509803922, + 0.37254901960784315, + 0.3764705882352941, + 0.3803921568627451, + 0.3843137254901961, + 0.38823529411764707, + 0.39215686274509803, + 0.396078431372549, + 0.4, + 0.403921568627451, + 0.40784313725490196, + 0.4117647058823529, + 0.41568627450980394, + 0.4196078431372549, + 0.4235294117647059, + 0.42745098039215684, + 0.43137254901960786, + 0.43529411764705883, + 0.4392156862745098, + 0.44313725490196076, + 0.4470588235294118, + 0.45098039215686275, + 0.4549019607843137, + 0.4588235294117647, + 0.4627450980392157, + 0.4666666666666667, + 0.47058823529411764, + 0.4745098039215686, + 0.47843137254901963, + 0.4823529411764706, + 0.48627450980392156, + 0.49019607843137253, + 0.49411764705882355, + 0.4980392156862745, + 0.5019607843137255, + 0.5058823529411764, + 0.5098039215686274, + 0.5137254901960784, + 0.5176470588235295, + 0.5215686274509804, + 0.5254901960784314, + 0.5294117647058824, + 0.5333333333333333, + 0.5372549019607843, + 0.5411764705882353, + 0.5450980392156862, + 0.5490196078431373, + 0.5529411764705883, + 0.5568627450980392, + 0.5607843137254902, + 0.5647058823529412, + 0.5686274509803921, + 0.5725490196078431, + 0.5764705882352941, + 0.5803921568627451, + 0.5843137254901961, + 0.5882352941176471, + 0.592156862745098, + 0.596078431372549, + 0.6, + 0.6039215686274509, + 0.6078431372549019, + 0.611764705882353, + 0.615686274509804, + 0.6196078431372549, + 0.6235294117647059, + 0.6274509803921569, + 0.6313725490196078, + 0.6352941176470588, + 0.6392156862745098, + 0.6431372549019608, + 0.6470588235294118, + 0.6509803921568628, + 0.6549019607843137, + 0.6588235294117647, + 0.6627450980392157, + 0.6666666666666666, + 0.6705882352941176, + 0.6745098039215687, + 0.6784313725490196, + 0.6823529411764706, + 0.6862745098039216, + 0.6901960784313725, + 0.6941176470588235, + 0.6980392156862745, + 0.7019607843137254, + 0.7058823529411765, + 0.7098039215686275, + 0.7137254901960784, + 0.7176470588235294, + 0.7215686274509804, + 0.7254901960784313, + 0.7294117647058823, + 0.7333333333333333, + 0.7372549019607844, + 0.7411764705882353, + 0.7450980392156863, + 0.7490196078431373, + 0.7529411764705882, + 0.7568627450980392, + 0.7607843137254902, + 0.7647058823529411, + 0.7686274509803922, + 0.7725490196078432, + 0.7764705882352941, + 0.7803921568627451, + 0.7843137254901961, + 0.788235294117647, + 0.792156862745098, + 0.796078431372549, + 0.8, + 0.803921568627451, + 0.807843137254902, + 0.8117647058823529, + 0.8156862745098039, + 0.8196078431372549, + 0.8235294117647058, + 0.8274509803921568, + 0.8313725490196079, + 0.8352941176470589, + 0.8392156862745098, + 0.8431372549019608, + 0.8470588235294118, + 0.8509803921568627, + 0.8549019607843137, + 0.8588235294117647, + 0.8627450980392157, + 0.8666666666666667, + 0.8705882352941177, + 0.8745098039215686, + 0.8784313725490196, + 0.8823529411764706, + 0.8862745098039215, + 0.8901960784313725, + 0.8941176470588236, + 0.8980392156862745, + 0.9019607843137255, + 0.9058823529411765, + 0.9098039215686274, + 0.9137254901960784, + 0.9176470588235294, + 0.9215686274509803, + 0.9254901960784314, + 0.9294117647058824, + 0.9333333333333333, + 0.9372549019607843, + 0.9411764705882353, + 0.9450980392156862, + 0.9490196078431372, + 0.9529411764705882, + 0.9568627450980393, + 0.9607843137254902, + 0.9647058823529412, + 0.9686274509803922, + 0.9725490196078431, + 0.9764705882352941, + 0.9803921568627451, + 0.984313725490196, + 0.9882352941176471, + 0.9921568627450981, + 0.996078431372549, + 1.0, +}; + +int _al_rgb_scale_1[] = { + 0, + 255, +}; + +int _al_rgb_scale_4[] = { + 0, + 17, + 34, + 51, + 68, + 85, + 102, + 119, + 136, + 153, + 170, + 187, + 204, + 221, + 238, + 255, +}; + +int _al_rgb_scale_5[] = { + 0, + 8, + 16, + 24, + 32, + 41, + 49, + 57, + 65, + 74, + 82, + 90, + 98, + 106, + 115, + 123, + 131, + 139, + 148, + 156, + 164, + 172, + 180, + 189, + 197, + 205, + 213, + 222, + 230, + 238, + 246, + 255, +}; + +int _al_rgb_scale_6[] = { + 0, + 4, + 8, + 12, + 16, + 20, + 24, + 28, + 32, + 36, + 40, + 44, + 48, + 52, + 56, + 60, + 64, + 68, + 72, + 76, + 80, + 85, + 89, + 93, + 97, + 101, + 105, + 109, + 113, + 117, + 121, + 125, + 129, + 133, + 137, + 141, + 145, + 149, + 153, + 157, + 161, + 165, + 170, + 174, + 178, + 182, + 186, + 190, + 194, + 198, + 202, + 206, + 210, + 214, + 218, + 222, + 226, + 230, + 234, + 238, + 242, + 246, + 250, + 255, +}; + +// Warning: This file was created by make_pixel_tables.py - do not edit. diff --git a/src/pixels.c b/src/pixels.c index 499217024f..e1b8421fe1 100644 --- a/src/pixels.c +++ b/src/pixels.c @@ -22,11 +22,7 @@ ALLEGRO_DEBUG_CHANNEL("pixels") /* lookup table for scaling 8 bit integers up to floats [0.0, 1.0] */ -float _al_u8_to_float[256]; -int _al_rgb_scale_1[2]; -int _al_rgb_scale_4[16]; -int _al_rgb_scale_5[32]; -int _al_rgb_scale_6[64]; +#include "pixel_tables.inc" static int pixel_sizes[] = { 0, /* ALLEGRO_PIXEL_FORMAT_ANY */ @@ -373,26 +369,6 @@ static bool format_is_compressed[ALLEGRO_NUM_PIXEL_FORMATS] = }; -void _al_init_pixels(void) -{ - int i; - for (i = 0; i < 256; i++) - _al_u8_to_float[i] = i / 255.0; - - for (i = 0; i < 2; i++) - _al_rgb_scale_1[i] = i * 255 / 1; - - for (i = 0; i < 16; i++) - _al_rgb_scale_4[i] = i * 255 / 15; - - for (i = 0; i < 32; i++) - _al_rgb_scale_5[i] = i * 255 / 31; - - for (i = 0; i < 64; i++) - _al_rgb_scale_6[i] = i * 255 / 63; -} - - /* Function: al_get_pixel_block_size */ int al_get_pixel_block_size(int format) diff --git a/src/system.c b/src/system.c index 9bb4c5644a..bbf81d2b08 100644 --- a/src/system.c +++ b/src/system.c @@ -264,6 +264,10 @@ bool al_install_system(int version, int (*atexit_ptr)(void (*)(void))) active_sysdrv = real_system; active_sysdrv->mouse_wheel_precision = 1; + const char *min_bitmap_size = al_get_config_value( + al_get_system_config(), "graphics", "min_bitmap_size"); + active_sysdrv->min_bitmap_size = min_bitmap_size ? atoi(min_bitmap_size) : 16; + ALLEGRO_INFO("Allegro version: %s\n", ALLEGRO_VERSION_STR); if (strcmp(al_get_app_name(), "") == 0) { @@ -276,8 +280,6 @@ bool al_install_system(int version, int (*atexit_ptr)(void (*)(void))) _al_init_events(); - _al_init_pixels(); - _al_init_iio_table(); _al_init_convert_bitmap_list(); diff --git a/src/win/d3d_bmp.cpp b/src/win/d3d_bmp.cpp index 7f94580ab2..1a55342693 100644 --- a/src/win/d3d_bmp.cpp +++ b/src/win/d3d_bmp.cpp @@ -667,6 +667,7 @@ void _al_d3d_refresh_texture_memory(ALLEGRO_DISPLAY *display) static bool d3d_upload_bitmap(ALLEGRO_BITMAP *bitmap) { ALLEGRO_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(bitmap); + ALLEGRO_SYSTEM *system = al_get_system_driver(); int bitmap_format = al_get_bitmap_format(bitmap); int system_format = d3d_bmp->system_format; int block_width = al_get_pixel_block_width(bitmap_format); @@ -699,8 +700,8 @@ static bool d3d_upload_bitmap(ALLEGRO_BITMAP *bitmap) } // Some cards/drivers don't like small textures - if (d3d_bmp->texture_w < 16) d3d_bmp->texture_w = 16; - if (d3d_bmp->texture_h < 16) d3d_bmp->texture_h = 16; + if (d3d_bmp->texture_w < system->min_bitmap_size) d3d_bmp->texture_w = system->min_bitmap_size; + if (d3d_bmp->texture_h < system->min_bitmap_size) d3d_bmp->texture_h = system->min_bitmap_size; ASSERT(d3d_bmp->texture_w % block_width == 0); ASSERT(d3d_bmp->texture_h % block_height == 0); diff --git a/src/win/d3d_disp.cpp b/src/win/d3d_disp.cpp index c44314bb47..60680cdaaf 100644 --- a/src/win/d3d_disp.cpp +++ b/src/win/d3d_disp.cpp @@ -1682,7 +1682,10 @@ static ALLEGRO_DISPLAY_D3D *d3d_create_display_internals( ALLEGRO_DEBUG("Trying format %d.\n", eds->index); d3d_display->depth_stencil_format = d3d_get_depth_stencil_format(eds); - d3d_display->samples = eds->settings[ALLEGRO_SAMPLES]; + if (eds->settings[ALLEGRO_SAMPLES] > 0) + d3d_display->samples = eds->settings[ALLEGRO_SAMPLES] - 1; + else + d3d_display->samples = 0; d3d_display->single_buffer = eds->settings[ALLEGRO_SINGLE_BUFFER] ? true : false; d3d_display->vsync = eds->settings[ALLEGRO_VSYNC] == 1; diff --git a/src/win/wgl_disp.c b/src/win/wgl_disp.c index 384e6b2ca6..3331b5f460 100644 --- a/src/win/wgl_disp.c +++ b/src/win/wgl_disp.c @@ -68,16 +68,20 @@ typedef struct WGL_DISPLAY_PARAMETERS { static bool is_wgl_extension_supported(_ALLEGRO_wglGetExtensionsStringARB_t _wglGetExtensionsStringARB, const char *extension, HDC dc) { - int ret; + bool ret = false; + const GLubyte* extensions; - /* XXX deprecated in OpenGL 3.0 */ - if (!glGetString(GL_EXTENSIONS)) - return false; - if (!_wglGetExtensionsStringARB) - return false; + if (_wglGetExtensionsStringARB) { + extensions = (const GLubyte*)_wglGetExtensionsStringARB(dc); + } + else { + /* XXX deprecated in OpenGL 3.0 */ + extensions = glGetString(GL_EXTENSIONS); + } - ret = _al_ogl_look_for_an_extension(extension, - (const GLubyte*)_wglGetExtensionsStringARB(dc)); + if (extensions) { + ret = _al_ogl_look_for_an_extension(extension, extensions); + } return ret; } @@ -609,6 +613,8 @@ static bool change_display_mode(ALLEGRO_DISPLAY *d) dm.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL | DM_DISPLAYFREQUENCY; result = ChangeDisplaySettingsEx(dev_name, &dm, NULL, CDS_FULLSCREEN, 0); + d->refresh_rate = dm.dmDisplayFrequency; + if (result != DISP_CHANGE_SUCCESSFUL) { ALLEGRO_ERROR("Unable to set mode. %s\n", _al_win_last_error()); return false; @@ -619,7 +625,7 @@ static bool change_display_mode(ALLEGRO_DISPLAY *d) } -static HGLRC init_ogl_context_ex(_ALLEGRO_wglGetExtensionsStringARB_t _wglGetExtensionsStringARB, HDC dc, bool fc, int major, int minor) +static HGLRC init_ogl_context_ex(HDC dc, bool fc, int major, int minor) { HWND testwnd = NULL; HDC testdc = NULL; @@ -640,6 +646,10 @@ static HGLRC init_ogl_context_ex(_ALLEGRO_wglGetExtensionsStringARB_t _wglGetExt if (!testrc) goto bail; + _ALLEGRO_wglGetExtensionsStringARB_t _wglGetExtensionsStringARB + = (_ALLEGRO_wglGetExtensionsStringARB_t)wglGetProcAddress("wglGetExtensionsStringARB"); + ALLEGRO_INFO("_wglGetExtensionsStringARB %p\n", _wglGetExtensionsStringARB); + if (is_wgl_extension_supported(_wglGetExtensionsStringARB, "WGL_ARB_create_context", testdc)) { int attrib[] = {WGL_CONTEXT_MAJOR_VERSION_ARB, major, WGL_CONTEXT_MINOR_VERSION_ARB, minor, @@ -674,7 +684,7 @@ static HGLRC init_ogl_context_ex(_ALLEGRO_wglGetExtensionsStringARB_t _wglGetExt } -static ALLEGRO_EXTRA_DISPLAY_SETTINGS** get_available_pixel_formats_ext(_ALLEGRO_wglGetExtensionsStringARB_t _wglGetExtensionsStringARB, int *count) +static ALLEGRO_EXTRA_DISPLAY_SETTINGS** get_available_pixel_formats_ext(int *count) { HWND testwnd = NULL; HDC testdc = NULL; @@ -704,11 +714,15 @@ static ALLEGRO_EXTRA_DISPLAY_SETTINGS** get_available_pixel_formats_ext(_ALLEGRO if (!testrc) goto bail; + _ALLEGRO_wglGetExtensionsStringARB_t _wglGetExtensionsStringARB + = (_ALLEGRO_wglGetExtensionsStringARB_t)wglGetProcAddress("wglGetExtensionsStringARB"); + ALLEGRO_INFO("_wglGetExtensionsStringARB %p\n", _wglGetExtensionsStringARB); + if (!is_wgl_extension_supported(_wglGetExtensionsStringARB, "WGL_ARB_pixel_format", testdc) && !is_wgl_extension_supported(_wglGetExtensionsStringARB, "WGL_EXT_pixel_format", testdc)) { ALLEGRO_ERROR("WGL_ARB/EXT_pf not supported.\n"); goto bail; - } + } if (!init_pixel_format_extensions()) goto bail; @@ -813,7 +827,7 @@ static ALLEGRO_EXTRA_DISPLAY_SETTINGS** get_available_pixel_formats_old(int *cou } -static bool select_pixel_format(_ALLEGRO_wglGetExtensionsStringARB_t _wglGetExtensionsStringARB, ALLEGRO_DISPLAY_WGL *d, HDC dc) +static bool select_pixel_format(ALLEGRO_DISPLAY_WGL *d, HDC dc) { ALLEGRO_EXTRA_DISPLAY_SETTINGS **eds = NULL; ALLEGRO_CONFIG *sys_cfg = al_get_system_config(); @@ -834,7 +848,7 @@ static bool select_pixel_format(_ALLEGRO_wglGetExtensionsStringARB_t _wglGetExte } if (!force_old) - eds = get_available_pixel_formats_ext(_wglGetExtensionsStringARB, &eds_count); + eds = get_available_pixel_formats_ext(&eds_count); if (!eds) eds = get_available_pixel_formats_old(&eds_count, dc); @@ -875,7 +889,7 @@ static bool select_pixel_format(_ALLEGRO_wglGetExtensionsStringARB_t _wglGetExte return true; } -static bool create_display_internals(_ALLEGRO_wglGetExtensionsStringARB_t _wglGetExtensionsStringARB, ALLEGRO_DISPLAY_WGL *wgl_disp) +static bool create_display_internals(ALLEGRO_DISPLAY_WGL *wgl_disp) { ALLEGRO_DISPLAY *disp = (void*)wgl_disp; ALLEGRO_DISPLAY_WIN *win_disp = (void*)wgl_disp; @@ -917,7 +931,7 @@ static bool create_display_internals(_ALLEGRO_wglGetExtensionsStringARB_t _wglGe /* WGL display lists cannot be shared with the API currently in use. */ disp->ogl_extras->is_shared = false; - if (!select_pixel_format(_wglGetExtensionsStringARB, wgl_disp, wgl_disp->dc)) { + if (!select_pixel_format(wgl_disp, wgl_disp->dc)) { destroy_display_internals(wgl_disp); return false; } @@ -930,7 +944,7 @@ static bool create_display_internals(_ALLEGRO_wglGetExtensionsStringARB_t _wglGe if (major == 0) major = 3; bool fc = (disp->flags & ALLEGRO_OPENGL_FORWARD_COMPATIBLE) != 0; - wgl_disp->glrc = init_ogl_context_ex(_wglGetExtensionsStringARB, wgl_disp->dc, fc, major, + wgl_disp->glrc = init_ogl_context_ex(wgl_disp->dc, fc, major, minor); } else { @@ -1020,9 +1034,7 @@ static ALLEGRO_DISPLAY* wgl_create_display(int w, int h) display->ogl_extras = al_calloc(1, sizeof(ALLEGRO_OGL_EXTRAS)); - _ALLEGRO_wglGetExtensionsStringARB_t _wglGetExtensionsStringARB - = (_ALLEGRO_wglGetExtensionsStringARB_t)wglGetProcAddress("wglGetExtensionsStringARB"); - if (!create_display_internals(_wglGetExtensionsStringARB, wgl_display)) { + if (!create_display_internals(wgl_display)) { al_free(display->ogl_extras); al_free(display); return NULL; @@ -1186,14 +1198,21 @@ static void display_thread_proc(void *arg) ALLEGRO_MONITOR_INFO mi; int adapter = win_disp->adapter; al_get_monitor_info(adapter, &mi); + win_disp->toggle_w = disp->w; win_disp->toggle_h = disp->h; + disp->w = mi.x2 - mi.x1; disp->h = mi.y2 - mi.y1; + + disp->refresh_rate = al_get_monitor_refresh_rate(adapter); } else { + int adapter = win_disp->adapter; win_disp->toggle_w = disp->w; win_disp->toggle_h = disp->h; + + disp->refresh_rate = al_get_monitor_refresh_rate(adapter); } win_disp->window = _al_win_create_window(disp, disp->w, disp->h, disp->flags); @@ -1329,7 +1348,7 @@ static void wgl_update_display_region(ALLEGRO_DISPLAY *d, } -static bool wgl_resize_helper(_ALLEGRO_wglGetExtensionsStringARB_t _wglGetExtensionsStringARB, ALLEGRO_DISPLAY *d, int width, int height) +static bool wgl_resize_helper(ALLEGRO_DISPLAY *d, int width, int height) { ALLEGRO_DISPLAY_WGL *wgl_disp = (ALLEGRO_DISPLAY_WGL *)d; ALLEGRO_DISPLAY_WIN *win_disp = (ALLEGRO_DISPLAY_WIN *)d; @@ -1378,7 +1397,7 @@ static bool wgl_resize_helper(_ALLEGRO_wglGetExtensionsStringARB_t _wglGetExtens d->w = width; d->h = height; - if(!create_display_internals(_wglGetExtensionsStringARB, wgl_disp)) + if(!create_display_internals(wgl_disp)) return false; /* We have a new backbuffer now. */ @@ -1433,10 +1452,8 @@ static bool wgl_resize_display(ALLEGRO_DISPLAY *d, int width, int height) win_display->ignore_resize = true; - _ALLEGRO_wglGetExtensionsStringARB_t _wglGetExtensionsStringARB - = (_ALLEGRO_wglGetExtensionsStringARB_t)wglGetProcAddress("wglGetExtensionsStringARB"); - if (!wgl_resize_helper(_wglGetExtensionsStringARB, d, width, height)) { - wgl_resize_helper(_wglGetExtensionsStringARB, d, orig_w, orig_h); + if (!wgl_resize_helper(d, width, height)) { + wgl_resize_helper(d, orig_w, orig_h); ret = false; } else { ret = true; diff --git a/src/win/wjoydxnu.cpp b/src/win/wjoydxnu.cpp index cb4eda4567..c13c050a47 100644 --- a/src/win/wjoydxnu.cpp +++ b/src/win/wjoydxnu.cpp @@ -991,11 +991,10 @@ static BOOL CALLBACK joystick_enum_callback(LPCDIDEVICEINSTANCE lpddi, LPVOID pv } { - LARGE_INTEGER due_time; - due_time.HighPart = 0; - due_time.LowPart = 150; /* 15 ms (arbitrary) */ + LARGE_INTEGER due_time = { 0 }; + due_time.QuadPart = -1; /* Start ASAP... */ SetWaitableTimer(joy->waker_event, - &due_time, true, /* periodic */ + &due_time, 15, /* ... then periodic, every 15ms*/ NULL, NULL, false); } } diff --git a/src/win/wsystem.c b/src/win/wsystem.c index ca299a6b89..602aebd9ed 100644 --- a/src/win/wsystem.c +++ b/src/win/wsystem.c @@ -496,6 +496,26 @@ static int win_find_nth_adapter_with_desktop(DISPLAY_DEVICE* pdd, int adapter) return false; } +static int win_get_monitor_refresh_rate(int adapter) +{ + DISPLAY_DEVICE dd; + DEVMODE dm; + + memset(&dd, 0, sizeof(dd)); + dd.cb = sizeof(dd); + if (!win_find_nth_adapter_with_desktop(&dd, adapter)) { + return 0; + } + + memset(&dm, 0, sizeof(dm)); + dm.dmSize = sizeof(dm); + if (!EnumDisplaySettings(dd.DeviceName, ENUM_CURRENT_SETTINGS, &dm)) { + return 0; + } + + return dm.dmDisplayFrequency; +} + static bool win_get_monitor_info(int adapter, ALLEGRO_MONITOR_INFO *info) { DISPLAY_DEVICE dd; @@ -905,6 +925,7 @@ static ALLEGRO_SYSTEM_INTERFACE *_al_system_win_driver(void) vt->destroy_mouse_cursor = _al_win_destroy_mouse_cursor; vt->get_monitor_info = win_get_monitor_info; vt->get_monitor_dpi = win_get_monitor_dpi; + vt->get_monitor_refresh_rate = win_get_monitor_refresh_rate; vt->get_cursor_position = win_get_cursor_position; vt->grab_mouse = win_grab_mouse; vt->ungrab_mouse = win_ungrab_mouse; diff --git a/src/x/xglx_config.c b/src/x/xglx_config.c index 305e2af51a..601dff9827 100644 --- a/src/x/xglx_config.c +++ b/src/x/xglx_config.c @@ -485,7 +485,7 @@ void _al_xglx_config_select_visual(ALLEGRO_DISPLAY_XGLX *glx) } static GLXContext create_context_new(int ver, Display *dpy, GLXFBConfig fb, - GLXContext ctx, bool forward_compat, bool want_es, int major, int minor) + GLXContext ctx, bool forward_compat, bool want_es, bool core_profile, int major, int minor) { typedef GLXContext (*GCCA_PROC) (Display*, GLXFBConfig, GLXContext, Bool, const int*); GCCA_PROC _xglx_glXCreateContextAttribsARB = NULL; @@ -519,6 +519,10 @@ static GLXContext create_context_new(int ver, Display *dpy, GLXFBConfig fb, attrib[6] = GLX_CONTEXT_PROFILE_MASK_ARB; attrib[7] = GLX_CONTEXT_ES_PROFILE_BIT_EXT; } + else if (core_profile) { + attrib[6] = GLX_CONTEXT_PROFILE_MASK_ARB; + attrib[7] = GLX_CONTEXT_CORE_PROFILE_BIT_ARB; + } return _xglx_glXCreateContextAttribsARB(dpy, fb, ctx, True, attrib); } @@ -541,20 +545,23 @@ bool _al_xglx_config_create_context(ALLEGRO_DISPLAY_XGLX *glx) if (glx->fbc) { bool forward_compat = (disp->flags & ALLEGRO_OPENGL_FORWARD_COMPATIBLE) != 0; + bool core_profile = (disp->flags & ALLEGRO_OPENGL_CORE_PROFILE) != 0; /* Create a GLX context from FBC. */ if (disp->flags & ALLEGRO_OPENGL_ES_PROFILE) { if (major == 0) major = 2; glx->context = create_context_new(glx->glx_version, system->gfxdisplay, *glx->fbc, existing_ctx, forward_compat, - true, major, minor); + true, core_profile, major, minor); } - else if ((disp->flags & ALLEGRO_OPENGL_3_0) || major != 0) { + else if ((disp->flags & ALLEGRO_OPENGL_3_0) || major != 0 || core_profile) { if (major == 0) major = 3; + if (core_profile && major == 3 && minor < 2) // core profile requires at least 3.2 + minor = 2; glx->context = create_context_new(glx->glx_version, system->gfxdisplay, *glx->fbc, existing_ctx, forward_compat, - false, major, minor); + false, core_profile, major, minor); /* TODO: Right now Allegro's own OpenGL driver only works with a 3.0+ * context when using the programmable pipeline, for some reason. All * that's missing is probably a default shader though. diff --git a/tests/test_prim.ini b/tests/test_prim.ini index a27dc80e65..07298748b5 100644 --- a/tests/test_prim.ini +++ b/tests/test_prim.ini @@ -91,32 +91,32 @@ sig=766666666769966966656659677676767A668666975666699655676678667666576798767766 [test hl thick-2] extend=hl thickness=2 -hash=2d8b8da2 +hash=639f3cad [test hl thick-10] extend=hl thickness=10 -hash=6f8b689d +hash=019f07b9 [test hl2 thick-50] extend=hl2 thickness=50 -hash=70941b3e +hash=a0129b37 [test hl2 thick-50 clip] extend=test hl2 thick-50 op2=al_set_clipping_rectangle(220, 140, 420, 340) -hash=8509c589 +hash=9039ee00 [test hl2 thick-50 nolight] extend=test hl2 thick-50 op3= -hash=85099dca +hash=dc66bfe1 [test hl2 thick-50 nolight clip] extend=test hl2 thick-50 clip op3= -hash=a9cd853f +hash=2e3bd424 [test hl fill] op0= al_draw_bitmap(bkg, 0, 0, 0) @@ -136,12 +136,12 @@ sig=76N6666667PP6667666OP657EF76QPd67EFF7P6c6UDFE66cb6TS6F66cc667666576775767766 [test hl fill clip] extend=test hl fill op2=al_set_clipping_rectangle(220, 140, 420, 340) -hash=e66f9bb4 +hash=923737a4 [test hl fill nolight] extend=test hl fill op3= -hash=fd9ec0e9 +hash=400eca07 [test hl fill subbmp dest] op0= subbmp = al_create_sub_bitmap(target, 60, 60, 540, 380) @@ -162,7 +162,7 @@ sig=00000000075666667677QP7757676PP665F97APQY56FE75P7c76EE766bbTSUF776db77777666 [test hl fill subbmp dest clip] extend=test hl fill subbmp dest op3=al_set_clipping_rectangle(220, 140, 300, 200) -hash=3b5b2b93 +hash=52d7f9fd [test circle] op0=al_clear_to_color(#884444)