Added WSA code from CC, Map Selection Works, temp disabled keyboard input for score screen.

This commit is contained in:
Justin Marshall
2020-06-04 15:10:30 -07:00
parent 9b2cf16b5f
commit e891377c96
8 changed files with 1272 additions and 104 deletions
+2
View File
@@ -1072,6 +1072,8 @@ extern DynamicVectorClass<ActionChoiceClass *> xxx3;
template <>class DynamicVectorClass<EgoClass *>;
extern DynamicVectorClass<EgoClass *> whatever;
void WWSDL_ProcessEvents(KeyNumType& key, int& flags);
/*
** Debug output. ST - 6/27/2019 10:00PM
*/
+1 -37
View File
@@ -460,7 +460,6 @@ void GadgetClass::Draw_All(bool forced)
}
}
/***************************************************************************
* GADGETCLASS::PROCESSLIST -- Check list for a mouse click within a gadget*
* *
@@ -535,42 +534,7 @@ KeyNumType GadgetClass::Input(void)
*/
// jmarshall
int flags = 0;
SDL_GetMouseState(&mousex, &mousey);
Keyboard->MouseQX = mousex;
Keyboard->MouseQY = mousey;
// if (flags == LEFTRELEASE || flags == RIGHTRELEASE)
// flags = 0;
SDL_Event event;
while (SDL_PollEvent(&event)) {
switch (event.type)
{
case SDL_MOUSEBUTTONDOWN:
if (event.button.button == SDL_BUTTON_LEFT) {
flags = LEFTPRESS;
key = KN_LMOUSE;
}
else if (event.button.button == SDL_BUTTON_RIGHT) {
flags = RIGHTPRESS;
key = KN_LMOUSE;
}
break;
case SDL_MOUSEBUTTONUP:
if (event.button.button == SDL_BUTTON_LEFT) {
flags = LEFTRELEASE;
}
else if (event.button.button == SDL_BUTTON_RIGHT) {
flags = RIGHTRELEASE;
}
break;
case SDL_KEYDOWN:
Keyboard->Put_Element(event.key.keysym.sym);
break;
}
}
WWSDL_ProcessEvents(key, flags);
// jmarshall end
/*
+4 -7
View File
@@ -107,8 +107,6 @@ extern short StreamLowImpact;
#endif
char const * Map_Selection(void)
{
return NULL;
#if (0)//PG
static char scenarioname[_MAX_FNAME+_MAX_EXT];
#ifdef FIXIT_ANTS
@@ -147,14 +145,14 @@ char const * Map_Selection(void)
void const * country1 = MFCD::Retrieve("TONEY10.AUD");
#ifdef WIN32
GraphicBufferClass *pseudoseenbuff = new GraphicBufferClass(320, 200, (void*)NULL);
GraphicBufferClass* pseudoseenbuff = &VisiblePage; // GraphicBufferClass(320, 200, (void*)NULL);
#endif
// fixed oldvolume = Options.ScoreVolume;
// Options.Set_Score_Volume(fixed(4, 10));
Theme.Queue_Song(THEME_MAP);
void *anim = Open_Animation(_filename, NULL, 0L, (WSAOpenType)(WSA_OPEN_FROM_MEM | WSA_OPEN_TO_PAGE), mappalette);
void *anim = Open_Animation(_filename, NULL, 0L, (WSAOpenType)(WSA_OPEN_FROM_MEM | WSA_OPEN_TO_PAGE), (unsigned char *)mappalette.Get_Data());
Keyboard->Clear();
SeenPage.Clear();
@@ -174,7 +172,7 @@ char const * Map_Selection(void)
int frame = 1;
StreamLowImpact = true;
//StreamLowImpact = true;
#ifdef WIN32
Play_Sample(appear1, 255, Options.Normalize_Volume(170));
#else
@@ -221,7 +219,7 @@ char const * Map_Selection(void)
break;
}
}
StreamLowImpact = false;
//StreamLowImpact = false;
Call_Back();
Close_Animation(anim);
Show_Mouse();
@@ -317,7 +315,6 @@ char const * Map_Selection(void)
// Scen.ScenVar = (ScenarioVarType)selection;
//Mono_Printf("Chose variant %d \n", selection);
return(scenarioname);
#endif
}
int Mouse_Over_Spot(int house, int scenario)
+1
View File
@@ -453,6 +453,7 @@
<ClCompile Include="Win32Lib\WINDOWS.CPP" />
<ClCompile Include="Win32Lib\WINHIDE.CPP" />
<ClCompile Include="Win32Lib\WRITEPCX.CPP" />
<ClCompile Include="WIN32LIB\WSA.CPP" />
<ClCompile Include="Win32Lib\_DIPTABL.CPP" />
<ClCompile Include="WINSTUB.CPP" />
<ClCompile Include="WOLAPIOB.CPP" />
+3
View File
@@ -939,6 +939,9 @@
<ClCompile Include="..\external\libsmacker\smk_hufftree.c">
<Filter>Source Files\libsmacker</Filter>
</ClCompile>
<ClCompile Include="WIN32LIB\WSA.CPP">
<Filter>Source Files\win32lib</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="ABSTRACT.H">
+66 -60
View File
@@ -1421,66 +1421,72 @@ void ScoreClass::Input_Name(char str[], int xpos, int ypos, char const pal[])
** with black.
*/
HidPage.Blit(HidPage, 0, 100*RESFACTOR, 0, 0, 100*RESFACTOR, 100*RESFACTOR);
do {
Call_Back();
Animate_Score_Objs();
Animate_Cursor(index, ypos);
if (Keyboard->Check()) {
key = Keyboard->To_ASCII(Keyboard->Get()) & 0xFF;
Call_Back();
if (index == MAX_FAMENAME_LENGTH-2) {
while (Keyboard->Check()) {
Keyboard->Get();
}
}
/*
** If they hit 'backspace' when they're on the last letter,
** turn it into a space instead.
*/
if ((key == KA_BACKSPACE) && (index == MAX_FAMENAME_LENGTH-2) ) {
if (str[index] && str[index]!=32) key = 32;
}
if (key == KA_BACKSPACE) { //if (key == KN_BACKSPACE) {
if (index) {
str[--index] = 0;
int xposindex6 = (xpos+(index*6))*RESFACTOR;
HidPage.Blit(SeenPage, xposindex6, (ypos-100)*RESFACTOR, xposindex6, ypos*RESFACTOR, 6*RESFACTOR, 6*RESFACTOR);
#ifdef WIN32
HidPage.Blit(*PseudoSeenBuff, xposindex6, (ypos-100)*RESFACTOR, xposindex6, ypos*RESFACTOR, 6*RESFACTOR, 6*RESFACTOR);
#endif
HidPage.Blit(HidPage, xposindex6, (ypos-100)*RESFACTOR, xposindex6, ypos*RESFACTOR, 6*RESFACTOR, 6*RESFACTOR);
}
} else if (key != KA_RETURN) { //else if (key != KN_RETURN && key!=KN_KEYPAD_RETURN) {
ascii = key; //ascii = KN_To_KA(key);
if (ascii >= 'a' && ascii <= 'z') ascii -= ('a' - 'A');
if ( (ascii >= '!' && ascii <= KA_TILDA) || ascii == ' ') {
HidPage.Blit(SeenPage, (xpos + (index*6))*RESFACTOR, (ypos-100)*RESFACTOR, (xpos + (index*6))*RESFACTOR, ypos*RESFACTOR, 6*RESFACTOR, 6*RESFACTOR);
#ifdef WIN32
HidPage.Blit(*PseudoSeenBuff, (xpos + (index*6))*RESFACTOR, (ypos-100)*RESFACTOR, (xpos + (index*6))*RESFACTOR, ypos*RESFACTOR, 6*RESFACTOR, 6*RESFACTOR);
#endif
HidPage.Blit(HidPage, (xpos + (index*6))*RESFACTOR, (ypos-100)*RESFACTOR, (xpos + (index*6))*RESFACTOR, ypos*RESFACTOR, 6*RESFACTOR, 6*RESFACTOR);
str[index] = ascii;
str[index+1] = 0;
int objindex;
#ifdef WIN32
Play_Sample(keystrok, 255, Options.Normalize_Volume(150));
#else
Play_Sample(keystrok, 255, Options.Normalize_Volume(105));
#endif
objindex = Alloc_Object(new ScoreScaleClass(str+index, xpos+(index*6), ypos, pal));
while (ScoreObjs[objindex]) Call_Back_Delay(1);
if (index < (MAX_FAMENAME_LENGTH-2) ) index++;
}
}
}
} while (key != KA_RETURN); // } while(key != KN_RETURN && key!=KN_KEYPAD_RETURN);
// jmarshall - temp disable high school writing.
// do {
//// jmarshall
// KeyNumType _key;
// int flags;
// WWSDL_ProcessEvents(_key, flags);
//// jmarshall end
// Call_Back();
// Animate_Score_Objs();
// Animate_Cursor(index, ypos);
// if (Keyboard->Check()) {
// key = Keyboard->To_ASCII(Keyboard->Get()) & 0xFF;
// Call_Back();
//
// if (index == MAX_FAMENAME_LENGTH-2) {
// while (Keyboard->Check()) {
// Keyboard->Get();
// }
// }
//
// /*
// ** If they hit 'backspace' when they're on the last letter,
// ** turn it into a space instead.
// */
// if ((key == KA_BACKSPACE) && (index == MAX_FAMENAME_LENGTH-2) ) {
// if (str[index] && str[index]!=32) key = 32;
// }
// if (key == KA_BACKSPACE) { //if (key == KN_BACKSPACE) {
// if (index) {
// str[--index] = 0;
//
// int xposindex6 = (xpos+(index*6))*RESFACTOR;
// HidPage.Blit(SeenPage, xposindex6, (ypos-100)*RESFACTOR, xposindex6, ypos*RESFACTOR, 6*RESFACTOR, 6*RESFACTOR);
// #ifdef WIN32
// HidPage.Blit(*PseudoSeenBuff, xposindex6, (ypos-100)*RESFACTOR, xposindex6, ypos*RESFACTOR, 6*RESFACTOR, 6*RESFACTOR);
// #endif
// HidPage.Blit(HidPage, xposindex6, (ypos-100)*RESFACTOR, xposindex6, ypos*RESFACTOR, 6*RESFACTOR, 6*RESFACTOR);
// }
//
// } else if (key != KA_RETURN) { //else if (key != KN_RETURN && key!=KN_KEYPAD_RETURN) {
// ascii = key; //ascii = KN_To_KA(key);
// if (ascii >= 'a' && ascii <= 'z') ascii -= ('a' - 'A');
// if ( (ascii >= '!' && ascii <= KA_TILDA) || ascii == ' ') {
// HidPage.Blit(SeenPage, (xpos + (index*6))*RESFACTOR, (ypos-100)*RESFACTOR, (xpos + (index*6))*RESFACTOR, ypos*RESFACTOR, 6*RESFACTOR, 6*RESFACTOR);
// #ifdef WIN32
// HidPage.Blit(*PseudoSeenBuff, (xpos + (index*6))*RESFACTOR, (ypos-100)*RESFACTOR, (xpos + (index*6))*RESFACTOR, ypos*RESFACTOR, 6*RESFACTOR, 6*RESFACTOR);
// #endif
// HidPage.Blit(HidPage, (xpos + (index*6))*RESFACTOR, (ypos-100)*RESFACTOR, (xpos + (index*6))*RESFACTOR, ypos*RESFACTOR, 6*RESFACTOR, 6*RESFACTOR);
// str[index] = ascii;
// str[index+1] = 0;
//
// int objindex;
//#ifdef WIN32
// Play_Sample(keystrok, 255, Options.Normalize_Volume(150));
//#else
// Play_Sample(keystrok, 255, Options.Normalize_Volume(105));
//#endif
// objindex = Alloc_Object(new ScoreScaleClass(str+index, xpos+(index*6), ypos, pal));
// while (ScoreObjs[objindex]) Call_Back_Delay(1);
//
// if (index < (MAX_FAMENAME_LENGTH-2) ) index++;
// }
// }
// }
// } while (key != KA_RETURN); // } while(key != KN_RETURN && key!=KN_KEYPAD_RETURN);
// jmarshall end
}
File diff suppressed because it is too large Load Diff
+42
View File
@@ -711,6 +711,48 @@ void __cdecl SetPalette(unsigned char *palette, long, unsigned long)
}
void WWSDL_ProcessEvents(KeyNumType& key, int& flags) {
extern int mousex, mousey;
SDL_GetMouseState(&mousex, &mousey);
Keyboard->MouseQX = mousex;
Keyboard->MouseQY = mousey;
// if (flags == LEFTRELEASE || flags == RIGHTRELEASE)
// flags = 0;
SDL_Event event;
while (SDL_PollEvent(&event)) {
switch (event.type)
{
case SDL_MOUSEBUTTONDOWN:
if (event.button.button == SDL_BUTTON_LEFT) {
flags = GadgetClass::LEFTPRESS;
key = KN_LMOUSE;
}
else if (event.button.button == SDL_BUTTON_RIGHT) {
flags = GadgetClass::RIGHTPRESS;
key = KN_LMOUSE;
}
break;
case SDL_MOUSEBUTTONUP:
if (event.button.button == SDL_BUTTON_LEFT) {
flags = GadgetClass::LEFTRELEASE;
}
else if (event.button.button == SDL_BUTTON_RIGHT) {
flags = GadgetClass::RIGHTRELEASE;
}
break;
case SDL_KEYDOWN:
Keyboard->Put_Element(event.key.keysym.sym);
break;
}
}
}
#ifndef NDEBUG
/***********************************************************************************************
* Assert_Failure -- display the line and source file where a failed assert occurred *