From 60f1d42a94c10cbe87786885c65226c7dbd8cf0a Mon Sep 17 00:00:00 2001 From: terminx Date: Wed, 22 Oct 2008 04:14:30 +0000 Subject: [PATCH] git-svn-id: https://svn.eduke32.com/eduke32@1110 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/Makefile | 3 +- polymer/eduke32/build/src/sdlayer.c | 264 ++++++++++---------- polymer/eduke32/source/game.c | 9 +- polymer/eduke32/source/jaudiolib/_multivc.h | 2 +- polymer/eduke32/source/jaudiolib/dsl.c | 7 +- 5 files changed, 145 insertions(+), 140 deletions(-) diff --git a/polymer/eduke32/build/Makefile b/polymer/eduke32/build/Makefile index e058f37cc..941e5330c 100644 --- a/polymer/eduke32/build/Makefile +++ b/polymer/eduke32/build/Makefile @@ -184,13 +184,14 @@ endif OURCFLAGS+= $(BUILDCFLAGS) +.SILENT: .PHONY: clean veryclean all utils enginelib editorlib # TARGETS UTILS=kextract$(EXESUFFIX) kgroup$(EXESUFFIX) transpal$(EXESUFFIX) wad2art$(EXESUFFIX) wad2map$(EXESUFFIX) -all: $(OBJ)/$(ENGINELIB) $(OBJ)/$(EDITORLIB) +# all: $(OBJ)/$(ENGINELIB) $(OBJ)/$(EDITORLIB) utils: $(UTILS) enginelib: $(OBJ)/$(ENGINELIB) diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index e8430c130..f3d988f08 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -1544,25 +1544,25 @@ int handleevents(void) break; } break; -/* - case SDL_MOUSEWHEEL: - initprintf("wheel y %d\n",ev.wheel.y); - if (ev.wheel.y > 0) - { - mwheelup = totalclock; - mouseb |= 16; - if (mousepresscallback) - mousepresscallback(5, 1); - } - if (ev.button.y < 0) - { - mwheeldown = totalclock; - mouseb |= 32; - if (mousepresscallback) - mousepresscallback(6, 1); - } - break; - */ + /* + case SDL_MOUSEWHEEL: + initprintf("wheel y %d\n",ev.wheel.y); + if (ev.wheel.y > 0) + { + mwheelup = totalclock; + mouseb |= 16; + if (mousepresscallback) + mousepresscallback(5, 1); + } + if (ev.wheel.y < 0) + { + mwheeldown = totalclock; + mouseb |= 32; + if (mousepresscallback) + mousepresscallback(6, 1); + } + break; + */ #else case SDL_KEYDOWN: case SDL_KEYUP: @@ -1889,119 +1889,119 @@ static int buildkeytranslationtable(void) return 0; } #else // SDL 1.3 -static int buildkeytranslationtable(void) -{ - memset(keytranslation,0,sizeof(keytranslation)); - -#define MAP(x,y) keytranslation[x] = y - printf("%d\n",SDL_SCANCODE_BACKSPACE); - MAP(SDL_SCANCODE_BACKSPACE, 0xe); - MAP(SDL_SCANCODE_TAB, 0xf); - MAP(SDL_SCANCODE_RETURN, 0x1c); - MAP(SDL_SCANCODE_PAUSE, 0x59); // 0x1d + 0x45 + 0x9d + 0xc5 - MAP(SDL_SCANCODE_ESCAPE, 0x1); - MAP(SDL_SCANCODE_SPACE, 0x39); - MAP(SDL_SCANCODE_COMMA, 0x33); - MAP(SDL_SCANCODE_MINUS, 0xc); - MAP(SDL_SCANCODE_PERIOD, 0x34); - MAP(SDL_SCANCODE_SLASH, 0x35); - MAP(SDL_SCANCODE_0, 0xb); - MAP(SDL_SCANCODE_1, 0x2); - MAP(SDL_SCANCODE_2, 0x3); - MAP(SDL_SCANCODE_3, 0x4); - MAP(SDL_SCANCODE_4, 0x5); - MAP(SDL_SCANCODE_5, 0x6); - MAP(SDL_SCANCODE_6, 0x7); - MAP(SDL_SCANCODE_7, 0x8); - MAP(SDL_SCANCODE_8, 0x9); - MAP(SDL_SCANCODE_9, 0xa); - MAP(SDL_SCANCODE_SEMICOLON, 0x27); - MAP(SDL_SCANCODE_EQUALS, 0xd); - MAP(SDL_SCANCODE_LEFTBRACKET, 0x1a); - MAP(SDL_SCANCODE_BACKSLASH, 0x2b); - MAP(SDL_SCANCODE_RIGHTBRACKET, 0x1b); - MAP(SDL_SCANCODE_A, 0x1e); - MAP(SDL_SCANCODE_B, 0x30); - MAP(SDL_SCANCODE_C, 0x2e); - MAP(SDL_SCANCODE_D, 0x20); - MAP(SDL_SCANCODE_E, 0x12); - MAP(SDL_SCANCODE_F, 0x21); - MAP(SDL_SCANCODE_G, 0x22); - MAP(SDL_SCANCODE_H, 0x23); - MAP(SDL_SCANCODE_I, 0x17); - MAP(SDL_SCANCODE_J, 0x24); - MAP(SDL_SCANCODE_K, 0x25); - MAP(SDL_SCANCODE_L, 0x26); - MAP(SDL_SCANCODE_M, 0x32); - MAP(SDL_SCANCODE_N, 0x31); - MAP(SDL_SCANCODE_O, 0x18); - MAP(SDL_SCANCODE_P, 0x19); - MAP(SDL_SCANCODE_Q, 0x10); - MAP(SDL_SCANCODE_R, 0x13); - MAP(SDL_SCANCODE_S, 0x1f); - MAP(SDL_SCANCODE_T, 0x14); - MAP(SDL_SCANCODE_U, 0x16); - MAP(SDL_SCANCODE_V, 0x2f); - MAP(SDL_SCANCODE_W, 0x11); - MAP(SDL_SCANCODE_X, 0x2d); - MAP(SDL_SCANCODE_Y, 0x15); - MAP(SDL_SCANCODE_Z, 0x2c); - MAP(SDL_SCANCODE_DELETE, 0xd3); - MAP(SDL_SCANCODE_KP_0, 0x52); - MAP(SDL_SCANCODE_KP_1, 0x4f); - MAP(SDL_SCANCODE_KP_2, 0x50); - MAP(SDL_SCANCODE_KP_3, 0x51); - MAP(SDL_SCANCODE_KP_4, 0x4b); - MAP(SDL_SCANCODE_KP_5, 0x4c); - MAP(SDL_SCANCODE_KP_6, 0x4d); - MAP(SDL_SCANCODE_KP_7, 0x47); - MAP(SDL_SCANCODE_KP_8, 0x48); - MAP(SDL_SCANCODE_KP_9, 0x49); - MAP(SDL_SCANCODE_KP_PERIOD, 0x53); - MAP(SDL_SCANCODE_KP_DIVIDE, 0xb5); - MAP(SDL_SCANCODE_KP_MULTIPLY, 0x37); - MAP(SDL_SCANCODE_KP_MINUS, 0x4a); - MAP(SDL_SCANCODE_KP_PLUS, 0x4e); - MAP(SDL_SCANCODE_KP_ENTER, 0x9c); - //MAP(SDL_SCANCODE_KP_EQUALS, ); - MAP(SDL_SCANCODE_UP, 0xc8); - MAP(SDL_SCANCODE_DOWN, 0xd0); - MAP(SDL_SCANCODE_RIGHT, 0xcd); - MAP(SDL_SCANCODE_LEFT, 0xcb); - MAP(SDL_SCANCODE_INSERT, 0xd2); - MAP(SDL_SCANCODE_HOME, 0xc7); - MAP(SDL_SCANCODE_END, 0xcf); - MAP(SDL_SCANCODE_PAGEUP, 0xc9); - MAP(SDL_SCANCODE_PAGEDOWN, 0xd1); - MAP(SDL_SCANCODE_F1, 0x3b); - MAP(SDL_SCANCODE_F2, 0x3c); - MAP(SDL_SCANCODE_F3, 0x3d); - MAP(SDL_SCANCODE_F4, 0x3e); - MAP(SDL_SCANCODE_F5, 0x3f); - MAP(SDL_SCANCODE_F6, 0x40); - MAP(SDL_SCANCODE_F7, 0x41); - MAP(SDL_SCANCODE_F8, 0x42); - MAP(SDL_SCANCODE_F9, 0x43); - MAP(SDL_SCANCODE_F10, 0x44); - MAP(SDL_SCANCODE_F11, 0x57); - MAP(SDL_SCANCODE_F12, 0x58); - MAP(SDL_SCANCODE_NUMLOCKCLEAR, 0x45); - MAP(SDL_SCANCODE_CAPSLOCK, 0x3a); - MAP(SDL_SCANCODE_SCROLLLOCK, 0x46); - MAP(SDL_SCANCODE_RSHIFT, 0x36); - MAP(SDL_SCANCODE_LSHIFT, 0x2a); - MAP(SDL_SCANCODE_RCTRL, 0x9d); - MAP(SDL_SCANCODE_LCTRL, 0x1d); - MAP(SDL_SCANCODE_RALT, 0xb8); - MAP(SDL_SCANCODE_LALT, 0x38); - MAP(SDL_SCANCODE_LGUI, 0xdb); // win l - MAP(SDL_SCANCODE_RGUI, 0xdc); // win r - MAP(SDL_SCANCODE_PRINTSCREEN, -2); // 0xaa + 0xb7 - MAP(SDL_SCANCODE_SYSREQ, 0x54); // alt+printscr - MAP(SDL_SCANCODE_PAUSE, 0xb7); // ctrl+pause - MAP(SDL_SCANCODE_MENU, 0xdd); // win menu? - MAP(SDL_SCANCODE_GRAVE, 0x29); // tilde -#undef MAP +static int buildkeytranslationtable(void) +{ + memset(keytranslation,0,sizeof(keytranslation)); + +#define MAP(x,y) keytranslation[x] = y + printf("%d\n",SDL_SCANCODE_BACKSPACE); + MAP(SDL_SCANCODE_BACKSPACE, 0xe); + MAP(SDL_SCANCODE_TAB, 0xf); + MAP(SDL_SCANCODE_RETURN, 0x1c); + MAP(SDL_SCANCODE_PAUSE, 0x59); // 0x1d + 0x45 + 0x9d + 0xc5 + MAP(SDL_SCANCODE_ESCAPE, 0x1); + MAP(SDL_SCANCODE_SPACE, 0x39); + MAP(SDL_SCANCODE_COMMA, 0x33); + MAP(SDL_SCANCODE_MINUS, 0xc); + MAP(SDL_SCANCODE_PERIOD, 0x34); + MAP(SDL_SCANCODE_SLASH, 0x35); + MAP(SDL_SCANCODE_0, 0xb); + MAP(SDL_SCANCODE_1, 0x2); + MAP(SDL_SCANCODE_2, 0x3); + MAP(SDL_SCANCODE_3, 0x4); + MAP(SDL_SCANCODE_4, 0x5); + MAP(SDL_SCANCODE_5, 0x6); + MAP(SDL_SCANCODE_6, 0x7); + MAP(SDL_SCANCODE_7, 0x8); + MAP(SDL_SCANCODE_8, 0x9); + MAP(SDL_SCANCODE_9, 0xa); + MAP(SDL_SCANCODE_SEMICOLON, 0x27); + MAP(SDL_SCANCODE_EQUALS, 0xd); + MAP(SDL_SCANCODE_LEFTBRACKET, 0x1a); + MAP(SDL_SCANCODE_BACKSLASH, 0x2b); + MAP(SDL_SCANCODE_RIGHTBRACKET, 0x1b); + MAP(SDL_SCANCODE_A, 0x1e); + MAP(SDL_SCANCODE_B, 0x30); + MAP(SDL_SCANCODE_C, 0x2e); + MAP(SDL_SCANCODE_D, 0x20); + MAP(SDL_SCANCODE_E, 0x12); + MAP(SDL_SCANCODE_F, 0x21); + MAP(SDL_SCANCODE_G, 0x22); + MAP(SDL_SCANCODE_H, 0x23); + MAP(SDL_SCANCODE_I, 0x17); + MAP(SDL_SCANCODE_J, 0x24); + MAP(SDL_SCANCODE_K, 0x25); + MAP(SDL_SCANCODE_L, 0x26); + MAP(SDL_SCANCODE_M, 0x32); + MAP(SDL_SCANCODE_N, 0x31); + MAP(SDL_SCANCODE_O, 0x18); + MAP(SDL_SCANCODE_P, 0x19); + MAP(SDL_SCANCODE_Q, 0x10); + MAP(SDL_SCANCODE_R, 0x13); + MAP(SDL_SCANCODE_S, 0x1f); + MAP(SDL_SCANCODE_T, 0x14); + MAP(SDL_SCANCODE_U, 0x16); + MAP(SDL_SCANCODE_V, 0x2f); + MAP(SDL_SCANCODE_W, 0x11); + MAP(SDL_SCANCODE_X, 0x2d); + MAP(SDL_SCANCODE_Y, 0x15); + MAP(SDL_SCANCODE_Z, 0x2c); + MAP(SDL_SCANCODE_DELETE, 0xd3); + MAP(SDL_SCANCODE_KP_0, 0x52); + MAP(SDL_SCANCODE_KP_1, 0x4f); + MAP(SDL_SCANCODE_KP_2, 0x50); + MAP(SDL_SCANCODE_KP_3, 0x51); + MAP(SDL_SCANCODE_KP_4, 0x4b); + MAP(SDL_SCANCODE_KP_5, 0x4c); + MAP(SDL_SCANCODE_KP_6, 0x4d); + MAP(SDL_SCANCODE_KP_7, 0x47); + MAP(SDL_SCANCODE_KP_8, 0x48); + MAP(SDL_SCANCODE_KP_9, 0x49); + MAP(SDL_SCANCODE_KP_PERIOD, 0x53); + MAP(SDL_SCANCODE_KP_DIVIDE, 0xb5); + MAP(SDL_SCANCODE_KP_MULTIPLY, 0x37); + MAP(SDL_SCANCODE_KP_MINUS, 0x4a); + MAP(SDL_SCANCODE_KP_PLUS, 0x4e); + MAP(SDL_SCANCODE_KP_ENTER, 0x9c); + //MAP(SDL_SCANCODE_KP_EQUALS, ); + MAP(SDL_SCANCODE_UP, 0xc8); + MAP(SDL_SCANCODE_DOWN, 0xd0); + MAP(SDL_SCANCODE_RIGHT, 0xcd); + MAP(SDL_SCANCODE_LEFT, 0xcb); + MAP(SDL_SCANCODE_INSERT, 0xd2); + MAP(SDL_SCANCODE_HOME, 0xc7); + MAP(SDL_SCANCODE_END, 0xcf); + MAP(SDL_SCANCODE_PAGEUP, 0xc9); + MAP(SDL_SCANCODE_PAGEDOWN, 0xd1); + MAP(SDL_SCANCODE_F1, 0x3b); + MAP(SDL_SCANCODE_F2, 0x3c); + MAP(SDL_SCANCODE_F3, 0x3d); + MAP(SDL_SCANCODE_F4, 0x3e); + MAP(SDL_SCANCODE_F5, 0x3f); + MAP(SDL_SCANCODE_F6, 0x40); + MAP(SDL_SCANCODE_F7, 0x41); + MAP(SDL_SCANCODE_F8, 0x42); + MAP(SDL_SCANCODE_F9, 0x43); + MAP(SDL_SCANCODE_F10, 0x44); + MAP(SDL_SCANCODE_F11, 0x57); + MAP(SDL_SCANCODE_F12, 0x58); + MAP(SDL_SCANCODE_NUMLOCKCLEAR, 0x45); + MAP(SDL_SCANCODE_CAPSLOCK, 0x3a); + MAP(SDL_SCANCODE_SCROLLLOCK, 0x46); + MAP(SDL_SCANCODE_RSHIFT, 0x36); + MAP(SDL_SCANCODE_LSHIFT, 0x2a); + MAP(SDL_SCANCODE_RCTRL, 0x9d); + MAP(SDL_SCANCODE_LCTRL, 0x1d); + MAP(SDL_SCANCODE_RALT, 0xb8); + MAP(SDL_SCANCODE_LALT, 0x38); + MAP(SDL_SCANCODE_LGUI, 0xdb); // win l + MAP(SDL_SCANCODE_RGUI, 0xdc); // win r + MAP(SDL_SCANCODE_PRINTSCREEN, -2); // 0xaa + 0xb7 + MAP(SDL_SCANCODE_SYSREQ, 0x54); // alt+printscr + MAP(SDL_SCANCODE_PAUSE, 0xb7); // ctrl+pause + MAP(SDL_SCANCODE_MENU, 0xdd); // win menu? + MAP(SDL_SCANCODE_GRAVE, 0x29); // tilde +#undef MAP return 0; } diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 23bb77184..6203e4e4f 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -11442,12 +11442,15 @@ MAIN_LOOP_RESTART: } { - static unsigned int lastrender = 0; + static unsigned int nextrender = 0; unsigned int j = getticks(); - if (r_maxfps == 0 || j >= lastrender+g_FrameDelay) + if (j > nextrender+g_FrameDelay) + nextrender = j; + + if (r_maxfps == 0 || j >= nextrender) { - lastrender = j; + nextrender += g_FrameDelay; displayrooms(screenpeek,i); displayrest(i); diff --git a/polymer/eduke32/source/jaudiolib/_multivc.h b/polymer/eduke32/source/jaudiolib/_multivc.h index 5bced8e97..15bc2f8b8 100644 --- a/polymer/eduke32/source/jaudiolib/_multivc.h +++ b/polymer/eduke32/source/jaudiolib/_multivc.h @@ -74,7 +74,7 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com) #if defined(_WIN32) #define MixBufferSize (MV_GetBufferSize(MV_RequestedMixRate)) #else -#define MixBufferSize 512 +#define MixBufferSize (scale(512, MV_RequestedMixRate, 11025)) #endif #define NumberOfBuffers 16 diff --git a/polymer/eduke32/source/jaudiolib/dsl.c b/polymer/eduke32/source/jaudiolib/dsl.c index 672fc6847..fd1955504 100644 --- a/polymer/eduke32/source/jaudiolib/dsl.c +++ b/polymer/eduke32/source/jaudiolib/dsl.c @@ -25,6 +25,7 @@ Adapted to work with JonoF's port by James Bentler (bentler@cs.umn.edu) #include "dsl.h" #include "compat.h" +#include "pragmas.h" #define _NEED_SDLMIXER 1 #include "sdl_inc.h" @@ -190,10 +191,10 @@ int DSL_BeginBufferedPlayback(char *BufferStart, 46ms isn't bad */ - chunksize = 512; + chunksize = scale(512, SampleRate, 11025); - if (SampleRate >= 16000) chunksize *= 2; - if (SampleRate >= 32000) chunksize *= 2; +// if (SampleRate >= 16000) chunksize *= 2; +// if (SampleRate >= 32000) chunksize *= 2; /* // SDL mixer does this already