Remove after_handleevents_hook and its only user, the keystatus-level clearing

of SPACE and C when in side-view mode. Now, this is accomplished by checking
directly in the overheadeditor code.

git-svn-id: https://svn.eduke32.com/eduke32@2119 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-11-25 09:50:07 +00:00
parent 568a7e1243
commit 57e132a044
7 changed files with 10 additions and 59 deletions

View file

@ -105,7 +105,6 @@ void initprintf(const char *, ...) ATTRIBUTE((format(printf,1,2)));
void debugprintf(const char *,...) ATTRIBUTE((format(printf,1,2))); void debugprintf(const char *,...) ATTRIBUTE((format(printf,1,2)));
int32_t handleevents(void); int32_t handleevents(void);
extern void (*after_handleevents_hook)(void);
extern inline void idle(void); extern inline void idle(void);
extern inline void idle_waitevent(void); extern inline void idle_waitevent(void);
extern inline void idle_waitevent_timeout(uint32_t timeout); extern inline void idle_waitevent_timeout(uint32_t timeout);

View file

@ -138,7 +138,6 @@ extern void screencoords(int32_t *xres, int32_t *yres, int32_t x, int32_t y, int
extern int32_t getinvdisplacement(int32_t *dx, int32_t *dy, int32_t dz) ATTRIBUTE((nonnull)); extern int32_t getinvdisplacement(int32_t *dx, int32_t *dy, int32_t dz) ATTRIBUTE((nonnull));
extern int32_t getscreenvdisp(int32_t bz, int32_t zoome); extern int32_t getscreenvdisp(int32_t bz, int32_t zoome);
extern void setup_sideview_sincos(void); extern void setup_sideview_sincos(void);
extern void m32_setkeyfilter(int32_t on);
extern void bfirst_search_init(int16_t *list, uint8_t *bitmap, int32_t *eltnumptr, int32_t maxnum, int16_t firstelt); extern void bfirst_search_init(int16_t *list, uint8_t *bitmap, int32_t *eltnumptr, int32_t maxnum, int16_t firstelt);
extern void bfirst_search_try(int16_t *list, uint8_t *bitmap, int32_t *eltnumptr, int16_t elt); extern void bfirst_search_try(int16_t *list, uint8_t *bitmap, int32_t *eltnumptr, int16_t elt);

View file

@ -25,7 +25,6 @@ int32_t joyaxespresent=0;
void(*keypresscallback)(int32_t,int32_t) = 0; void(*keypresscallback)(int32_t,int32_t) = 0;
void(*mousepresscallback)(int32_t,int32_t) = 0; void(*mousepresscallback)(int32_t,int32_t) = 0;
void(*joypresscallback)(int32_t,int32_t) = 0; void(*joypresscallback)(int32_t,int32_t) = 0;
void (*after_handleevents_hook)(void) = 0;
extern int16_t brightness; extern int16_t brightness;

View file

@ -95,7 +95,7 @@ extern char textfont[128][8];
// only valid when highlightsectorcnt>0 and no structural // only valid when highlightsectorcnt>0 and no structural
// modifications (deleting/inserting sectors or points, setting new firstwall) // modifications (deleting/inserting sectors or points, setting new firstwall)
// have been made // have been made
static int16_t onextwall[MAXWALLS]; // onextwall[i]>=0 implies wall[j].nextwall < 0 static int16_t onextwall[MAXWALLS]; // onextwall[i]>=0 implies wall[i].nextwall < 0
static void mkonwvalid(void) { chsecptr_onextwall = onextwall; } static void mkonwvalid(void) { chsecptr_onextwall = onextwall; }
static void mkonwinvalid(void) { chsecptr_onextwall = NULL; } static void mkonwinvalid(void) { chsecptr_onextwall = NULL; }
static int32_t onwisvalid(void) { return chsecptr_onextwall != NULL; } static int32_t onwisvalid(void) { return chsecptr_onextwall != NULL; }
@ -1857,35 +1857,6 @@ void update_highlightsector(void)
} }
} }
// hook run after handleevents in side view
static void sideview_filter_keys(void)
{
uint32_t i;
for (i=0; i<sizeof(keystatus)/sizeof(keystatus[0]); i++)
{
switch (i)
{
// case 0xd2: case 0xd3: // ins, del
case 0x2e: case 0x39: // c, space
// case 0xb8: // ralt
keystatus[i] = 0;
break;
}
}
}
void m32_setkeyfilter(int32_t on)
{
if (m32_sideview && on)
{
after_handleevents_hook = &sideview_filter_keys;
clearkeys();
}
else
after_handleevents_hook = 0;
}
// Get average point of sectors // Get average point of sectors
static void get_sectors_center(const int16_t *sectors, int32_t numsecs, int32_t *cx, int32_t *cy) static void get_sectors_center(const int16_t *sectors, int32_t numsecs, int32_t *cx, int32_t *cy)
{ {
@ -2589,8 +2560,6 @@ void overheadeditor(void)
ovh.splitsect = -1; ovh.splitsect = -1;
ovh.splitstartwall = -1; ovh.splitstartwall = -1;
m32_setkeyfilter(1);
qsetmodeany(xdim2d,ydim2d); qsetmodeany(xdim2d,ydim2d);
xdim2d = xdim; xdim2d = xdim;
ydim2d = ydim; ydim2d = ydim;
@ -4645,8 +4614,6 @@ end_point_dragging:
{ {
m32_sideview = !m32_sideview; m32_sideview = !m32_sideview;
printmessage16("Side view %s", m32_sideview?"enabled":"disabled"); printmessage16("Side view %s", m32_sideview?"enabled":"disabled");
m32_setkeyfilter(1);
} }
} }
@ -5554,12 +5521,11 @@ end_join_sectors:
duplicate_selected_sectors(); duplicate_selected_sectors();
else if (highlightcnt > 0) else if (highlightcnt > 0)
duplicate_selected_sprites(); duplicate_selected_sprites();
else if (circlewall >= 0) else if (circlewall >= 0)
{ {
circlewall = -1; circlewall = -1;
} }
else else if (!m32_sideview)
{ {
if (linehighlight >= 0) if (linehighlight >= 0)
{ {
@ -5574,10 +5540,11 @@ end_join_sectors:
circlewall = linehighlight; circlewall = linehighlight;
} }
} }
keystatus[0x2e] = 0; keystatus[0x2e] = 0;
} }
bad = keystatus[0x39]; //Gotta do this to save lots of 3 spaces! bad = keystatus[0x39] && !m32_sideview; //Gotta do this to save lots of 3 spaces!
if (circlewall >= 0) if (circlewall >= 0)
{ {
@ -6651,8 +6618,6 @@ nextmap:
CANCEL: CANCEL:
if (keystatus[1]) if (keystatus[1])
{ {
m32_setkeyfilter(0);
keystatus[1] = 0; keystatus[1] = 0;
#if M32_UNDO #if M32_UNDO
_printmessage16("(N)ew, (L)oad, (S)ave, save (A)s, (T)est map, (U)ndo, (R)edo, (Q)uit"); _printmessage16("(N)ew, (L)oad, (S)ave, save (A)s, (T)est map, (U)ndo, (R)edo, (Q)uit");
@ -6915,8 +6880,6 @@ CANCEL:
} }
clearkeys(); clearkeys();
m32_setkeyfilter(1);
} }
VM_OnEvent(EVENT_KEYS2D, -1); VM_OnEvent(EVENT_KEYS2D, -1);
@ -6952,8 +6915,6 @@ CANCEL:
searchx = clamp(scale(searchx,xdimgame,xdim2d), 8, xdimgame-8-1); searchx = clamp(scale(searchx,xdimgame,xdim2d), 8, xdimgame-8-1);
searchy = clamp(scale(searchy,ydimgame,ydim2d-STATUS2DSIZ), 8, ydimgame-8-1); searchy = clamp(scale(searchy,ydimgame,ydim2d-STATUS2DSIZ), 8, ydimgame-8-1);
m32_setkeyfilter(0);
VM_OnEvent(EVENT_ENTER3DMODE, -1); VM_OnEvent(EVENT_ENTER3DMODE, -1);
} }

View file

@ -75,6 +75,8 @@ char nogl=0;
#endif #endif
int32_t vsync=0; int32_t vsync=0;
//#define KEY_PRINT_DEBUG
#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) #if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3)
static char keytranslation[SDLK_LAST]; static char keytranslation[SDLK_LAST];
#else #else
@ -1676,7 +1678,10 @@ int32_t handleevents(void)
case SDL_KEYDOWN: case SDL_KEYDOWN:
case SDL_KEYUP: case SDL_KEYUP:
code = keytranslation[ev.key.keysym.sym]; code = keytranslation[ev.key.keysym.sym];
#ifdef KEY_PRINT_DEBUG
printf("keytranslation[%d] = %s (%d) %s\n", ev.key.keysym.sym,
key_names[code], code, ev.key.type==SDL_KEYDOWN?"DOWN":"UP");
#endif
if (code != OSD_OSDKey() && ev.key.keysym.unicode != 0 && ev.key.type == SDL_KEYDOWN && if (code != OSD_OSDKey() && ev.key.keysym.unicode != 0 && ev.key.type == SDL_KEYDOWN &&
(ev.key.keysym.unicode & 0xff80) == 0 && (ev.key.keysym.unicode & 0xff80) == 0 &&
((keyasciififoend+1)&(KEYFIFOSIZ-1)) != keyasciififoplc) ((keyasciififoend+1)&(KEYFIFOSIZ-1)) != keyasciififoplc)
@ -1881,9 +1886,6 @@ int32_t handleevents(void)
#undef SetKey #undef SetKey
if (after_handleevents_hook)
after_handleevents_hook();
return rv; return rv;
} }

View file

@ -769,9 +769,6 @@ int32_t handleevents(void)
sampletimer(); sampletimer();
if (after_handleevents_hook)
after_handleevents_hook();
return rv; return rv;
} }

View file

@ -7853,11 +7853,7 @@ static void Keys2d(void)
{ {
// PK_ // PK_
if (numhelppages>0) if (numhelppages>0)
{
m32_setkeyfilter(0);
IntegratedHelp(); IntegratedHelp();
m32_setkeyfilter(1);
}
else else
printmessage16("m32help.hlp invalid or not found!"); printmessage16("m32help.hlp invalid or not found!");
} }
@ -7865,9 +7861,7 @@ static void Keys2d(void)
if (PRESSED_KEYSC(F2)) if (PRESSED_KEYSC(F2))
if (g_numsounds > 0) if (g_numsounds > 0)
{ {
m32_setkeyfilter(0);
SoundDisplay(); SoundDisplay();
m32_setkeyfilter(1);
} }
// F3: side view toggle (handled in build.c) // F3: side view toggle (handled in build.c)