ref: abb641229351d84fdea729a622b359c3eb43d5ce
parent: 6701f55b7f5aa498ff449500a768ae00675615e1
parent: 30cb9def10f532b54652938bf3fed34071fad30b
author: LTCHIPS <stevenlevesque3@gmail.com>
date: Wed Sep 23 10:56:27 EDT 2020
Merge branch 'bugfix' into master
--- a/src/rt_in.c
+++ b/src/rt_in.c
@@ -150,9 +150,6 @@
static char *ParmStrings[] = {"nojoys","nomouse",NULL};
-#if USE_SDL
-#define sdldebug printf
-
static int sdl_mouse_button_filter(SDL_Event const *event)
{
/*
@@ -189,20 +186,20 @@
} /* if */
else
{
- if (sdl_mouse_grabbed || sdl_fullscreen)
- {
+ //if (sdl_mouse_grabbed || sdl_fullscreen)
+ //{
mouse_relative_x = event->motion.xrel;
mouse_relative_y = event->motion.yrel;
mouse_x += mouse_relative_x;
mouse_y += mouse_relative_y;
- } /* if */
- else
- {
- mouse_relative_x = event->motion.x - mouse_x;
- mouse_relative_y = event->motion.y - mouse_y;
- mouse_x = event->motion.x;
- mouse_y = event->motion.y;
- } /* else */
+ //} /* if */
+ //else
+ //{
+ //mouse_relative_x = event->motion.x - mouse_x;
+ //mouse_relative_y = event->motion.y - mouse_y;
+ //mouse_x = event->motion.x;
+ //mouse_y = event->motion.y;
+ //} /* else */
} /* else */
/* set static vars... */
@@ -268,7 +265,7 @@
kp_enter_hack = 0;
//retval = scancodes = Lookup(scancodes, SDLK_KP_ENTER);
retval = Lookup(scancodes, SDLK_KP_ENTER);
-
+
//retval = scancodes[SDLK_KP_ENTER];
} /* if */
} /* if */
@@ -285,8 +282,8 @@
int strippedkey;
//SDL_GrabMode grab_mode = SDL_GRAB_OFF;
int extended;
-
-
+
+
if ( (event->key.keysym.sym == SDLK_g) &&
(event->key.state == SDL_PRESSED) &&
(event->key.keysym.mod & KMOD_CTRL) )
@@ -331,7 +328,7 @@
k = Lookup(scancodes, event->key.keysym.sym);
//k = scancodes[event->key.keysym.sym];
//}
-
+
if (!k) /* No DOS equivalent defined. */
return(0);
} /* if */
@@ -412,7 +409,6 @@
while (SDL_PollEvent(&event))
root_sdl_event_filter(&event);
} /* sdl_handle_events */
-#endif
//******************************************************************************
@@ -757,11 +753,11 @@
except where no such name is available.
*/
//calloc(scancodes, sizeof(unsigned int) * 513);
-
+
scancodes = malloc(sizeof(HashTable));
-
+
InitHashTable(scancodes, SDL_NUM_SCANCODES);
-
+
Insert(scancodes, SDLK_ESCAPE, sc_Escape);
Insert(scancodes, SDLK_1, sc_1);
Insert(scancodes, SDLK_2, sc_2);
@@ -773,9 +769,9 @@
Insert(scancodes, SDLK_8, sc_8);
Insert(scancodes, SDLK_9, sc_9);
Insert(scancodes, SDLK_0, sc_0);
-
+
Insert(scancodes, SDLK_EQUALS, sc_Equals);
-
+
Insert(scancodes, SDLK_BACKSPACE, sc_BackSpace);
Insert(scancodes, SDLK_TAB, sc_Tab);
Insert(scancodes, SDLK_q, sc_Q);
@@ -791,8 +787,8 @@
Insert(scancodes, SDLK_LEFTBRACKET, sc_OpenBracket);
Insert(scancodes, SDLK_RIGHTBRACKET, sc_CloseBracket);
Insert(scancodes, SDLK_RETURN, sc_Return);
- Insert(scancodes, SDLK_LCTRL, sc_Control);
-
+ Insert(scancodes, SDLK_LCTRL, sc_Control);
+
Insert(scancodes, SDLK_PAGEUP, sc_PgUp);
Insert(scancodes, SDLK_s, sc_S);
Insert(scancodes, SDLK_d, sc_D);
@@ -805,9 +801,9 @@
Insert(scancodes, SDLK_SEMICOLON, 0x27);
Insert(scancodes, SDLK_QUOTE, 0x28);
Insert(scancodes, SDLK_BACKQUOTE, 0x29);
-
+
Insert(scancodes, SDLK_LSHIFT, sc_RShift);
-
+
Insert(scancodes, SDLK_BACKSLASH, 0x2B);
Insert(scancodes, SDLK_z, sc_Z);
Insert(scancodes, SDLK_x, sc_X);
@@ -821,7 +817,7 @@
Insert(scancodes, SDLK_SLASH, 0x35);
Insert(scancodes, SDLK_RSHIFT, sc_RShift);
Insert(scancodes, SDLK_KP_DIVIDE, 0x35);
-
+
Insert(scancodes, SDLK_LALT, sc_Alt);
Insert(scancodes, SDLK_RALT, sc_Alt);
Insert(scancodes, SDLK_MODE, sc_Alt);
@@ -844,9 +840,9 @@
Insert(scancodes, SDLK_F12, sc_F12);
Insert(scancodes, SDLK_NUMLOCKCLEAR, 0x45);
Insert(scancodes, SDLK_SCROLLLOCK, 0x46);
-
+
Insert(scancodes, SDLK_MINUS, sc_Minus);
-
+
Insert(scancodes, SDLK_KP_PERIOD, sc_Delete);
Insert(scancodes, SDLK_KP_7, sc_Home);
Insert(scancodes, SDLK_KP_8, sc_UpArrow);
@@ -860,7 +856,7 @@
Insert(scancodes, SDLK_KP_6, sc_RightArrow);
Insert(scancodes, SDLK_LEFT, sc_LeftArrow);
Insert(scancodes, SDLK_RIGHT, sc_RightArrow);
-
+
Insert(scancodes, SDLK_KP_1, sc_End);
Insert(scancodes, SDLK_KP_2, sc_DownArrow);
Insert(scancodes, SDLK_KP_3, sc_PgDn);
--- a/src/rt_map.c
+++ b/src/rt_map.c
@@ -154,7 +154,7 @@
{
s=source;
-
+
b=buf;
for (i=0; i<tilesize; i++,b++)
@@ -195,7 +195,7 @@
x*=tilesize;
y*=tilesize;
-
+
buf=(byte *)bufferofs+ylookup[y]+x;
{
s=skytile;
@@ -707,7 +707,7 @@
void DrawMapInfo ( void )
{
char temp[80];
-
+
int width,height;
CurrentFont=tinyfont;
@@ -714,32 +714,36 @@
PrintX = 2;
PrintY = 2;
- strncpy (&temp[0], LevelName, strlen(LevelName));
- US_MeasureStr (&width, &height, "%s", &temp[0]);
+ strncpy (temp, LevelName, strlen(LevelName)+1);
+ US_MeasureStr (&width, &height, "%s", temp);
VWB_TBar (0, 0, 320, height+4);
US_BufPrint (&temp[0]);
-
- strncpy (&temp[0], "", strlen(LevelName)); //reset temp
- strncpy (&temp[0], "TAB=EXIT", 8);
- US_MeasureStr (&width, &height, "%s", &temp[0]);
+ //memset(temp, 0, strlen(LevelName))
+ strncpy (temp, "", strlen(LevelName)+1); //reset temp
+
+ strncpy (temp, "TAB=EXIT", 8+1);
+ US_MeasureStr (&width, &height, "%s", temp);
+
PrintX = 316-width;
PrintY = 2;
- US_BufPrint (&temp[0]);
+ US_BufPrint (temp);
- strncpy (&temp[0], "", strlen(LevelName)); //reset temp
-
- strncpy (&temp[0], "< > CHANGE BACKGROUND COLOR", 27);
- US_MeasureStr (&width, &height, "%s", &temp[0]);
+ strncpy (temp, "", 8); //reset temp
+ strncpy (temp, "< > CHANGE BACKGROUND COLOR", 27+1);
+ US_MeasureStr (&width, &height, "%s", temp);
+
PrintX = (320-width)>>1;
PrintY = 2;
- US_BufPrint (&temp[0]);
+ US_BufPrint (temp);
+
+ //strncpy (temp, "", 27);
}
/*