SDL event processing is now done in Call_back. Fixed garbage pixels when opening in game menu dialog. Surrender dialog will now always render. Moved WWKeyboardClass::Head/WWKeyboardClass::Tail to static vars in prep for re-write.

This commit is contained in:
Justin Marshall
2020-06-16 11:54:13 -07:00
parent fca09a5f32
commit 3cbdd10813
8 changed files with 31 additions and 24 deletions
BIN
View File
Binary file not shown.
+5
View File
@@ -143,6 +143,9 @@ extern void Do_Draw(void);
bool bNoMovies = false;
#endif
KeyNumType g_globalKeyNumType = KN_NONE;
int g_globalKeyFlags = 0;
/****************************************
** Function prototypes for this module **
*****************************************/
@@ -1635,6 +1638,8 @@ void Color_Cycle(void)
*=============================================================================================*/
void Call_Back(void)
{
WWSDL_ProcessEvents(g_globalKeyNumType, g_globalKeyFlags);
/*
** Music and speech maintenance
*/
+12 -12
View File
@@ -99,7 +99,7 @@ void Dialog_Box(int x, int y, int w, int h)
int cx = w/2;
int cy = h/2;
// jmarshall
void const * shapedata = MFCD::Retrieve("DD-BKGND.SHP");
//void const * shapedata = MFCD::Retrieve("DD-BKGND.SHP");
//#ifdef WIN32
// CC_Draw_Shape(shapedata, 0, cx-312, cy-192, WINDOW_PARTIAL, SHAPE_WIN_REL);
// CC_Draw_Shape(shapedata, 1, cx, cy-192, WINDOW_PARTIAL, SHAPE_WIN_REL);
@@ -197,17 +197,17 @@ void Dialog_Box(int x, int y, int w, int h)
//CC_Draw_Shape(shapedata, 2, 0, h-(12*RESFACTOR), WINDOW_PARTIAL, SHAPE_WIN_REL);
//CC_Draw_Shape(shapedata, 3, w-(12*RESFACTOR-1), h-(12*RESFACTOR), WINDOW_PARTIAL, SHAPE_WIN_REL);
#ifdef WIN32
WWMouse->Draw_Mouse(&HidPage);
HidPage.Blit(SeenBuff, x, y, x, y, w, h, false);
WWMouse->Erase_Mouse(&HidPage, FALSE);
#else
// Shadow_Blit(0, 0, 320, 200, HidPage, SeenPage, Map.ShadowPage->Get_Buffer());
Hide_Mouse();
HidPage.Blit(SeenBuff);
Show_Mouse();
// Shadow_Blit(0, 0, 320, 200, HidPage, SeenPage, ((GraphicBufferClass*)Map.Shadow_Address())->Get_Buffer());
#endif
//#ifdef WIN32
// WWMouse->Draw_Mouse(&HidPage);
// HidPage.Blit(SeenBuff, x, y, x, y, w, h, false);
// WWMouse->Erase_Mouse(&HidPage, FALSE);
//#else
//// Shadow_Blit(0, 0, 320, 200, HidPage, SeenPage, Map.ShadowPage->Get_Buffer());
// Hide_Mouse();
// HidPage.Blit(SeenBuff);
// Show_Mouse();
//// Shadow_Blit(0, 0, 320, 200, HidPage, SeenPage, ((GraphicBufferClass*)Map.Shadow_Address())->Get_Buffer());
//#endif
Set_Logic_Page(oldpage);
GL_ResetClipRect();
+2 -1
View File
@@ -1183,5 +1183,6 @@ __forceinline void COM_SetExtension(char* path, int maxSize, const char* extensi
}
extern bool g_inMainMenu;
extern KeyNumType g_globalKeyNumType;
extern int g_globalKeyFlags;
#endif
+1 -4
View File
@@ -533,10 +533,7 @@ KeyNumType GadgetClass::Input(void)
** rather the the mouse position at the time we get around to this function.
*/
// jmarshall
int flags = 0;
WWSDL_ProcessEvents(key, flags);
Show_Mouse(); // jmarshall: thsi shouldn't be here!
int flags = g_globalKeyFlags;
// jmarshall end
/*
+4 -1
View File
@@ -694,7 +694,7 @@ int Surrender_Dialog(int text)
//.....................................................................
// Refresh display if needed
//.....................................................................
if (display) {
{
display = false;
//..................................................................
@@ -730,6 +730,9 @@ int Surrender_Dialog(int text)
// Get user input
//.....................................................................
KeyNumType input = commands->Input();
// jmarshall
Call_Back();
// jmarshall end
//.....................................................................
// Process input
+5 -5
View File
@@ -651,11 +651,6 @@ oh_dear_its_a_label:
}
}
/*
........................ Invoke game callback .........................
*/
Call_Back();
#ifdef WIN32
/*
** If we have just received input focus again after running in the background then
@@ -795,6 +790,11 @@ oh_dear_its_a_label:
bool droplist_is_dropped = housebtn.IsDropped;
input = commands->Input();
/*
........................ Invoke game callback .........................
*/
Call_Back();
Load_Title_Page(true);
/*
+2 -1
View File
@@ -679,7 +679,8 @@ void WWSDL_ProcessEvents(KeyNumType& key, int& flags, bool presentBuffer) {
// if (flags == LEFTRELEASE || flags == RIGHTRELEASE)
// flags = 0;
SDL_Event event;
static SDL_Event event;
memset(&event, 0, sizeof(SDL_Event));
while (SDL_PollEvent(&event)) {
switch (event.type)
{