Keyboard now works, exit the game doesn't crash, feedback audio no longer plays the wrong audio.

This commit is contained in:
Justin Marshall
2020-06-04 14:19:12 -07:00
parent 5f0ca2d192
commit fa3493dd30
7 changed files with 43 additions and 38 deletions
+2 -2
View File
@@ -53,7 +53,7 @@ typedef struct {
short flags; short flags;
} KeyFrameHeaderType; } KeyFrameHeaderType;
#define INITIAL_BIG_SHAPE_BUFFER_SIZE 8000000 #define INITIAL_BIG_SHAPE_BUFFER_SIZE (64 * 1024 * 1024)
#define THEATER_BIG_SHAPE_BUFFER_SIZE 4000000 #define THEATER_BIG_SHAPE_BUFFER_SIZE 4000000
#define UNCOMPRESS_MAGIC_NUMBER 56789 #define UNCOMPRESS_MAGIC_NUMBER 56789
@@ -62,7 +62,7 @@ unsigned TheaterShapeBufferLength = THEATER_BIG_SHAPE_BUFFER_SIZE;
extern "C"{ extern "C"{
char *BigShapeBufferStart = NULL; char *BigShapeBufferStart = NULL;
char *TheaterShapeBufferStart = NULL; char *TheaterShapeBufferStart = NULL;
BOOL UseBigShapeBuffer = FALSE; BOOL UseBigShapeBuffer = TRUE;
bool IsTheaterShape = false; bool IsTheaterShape = false;
} }
#ifdef FIXIT_SCORE_CRASH #ifdef FIXIT_SCORE_CRASH
-26
View File
@@ -838,29 +838,3 @@ void Stop_Speaking(void)
SpeakQueue = VOX_NONE; SpeakQueue = VOX_NONE;
Stop_Sample_Playing(SpeechBuffer); Stop_Sample_Playing(SpeechBuffer);
} }
/***********************************************************************************************
* Is_Speaking -- Checks to see if the eva voice is still playing. *
* *
* Call this routine when the EVA voice being played needs to be checked. A typical use *
* of this would be when some action needs to be delayed until the voice has finished -- *
* say the end of the game. *
* *
* INPUT: none *
* *
* OUTPUT: bool; Is the EVA voice still playing? *
* *
* WARNINGS: none *
* *
* HISTORY: *
* 03/12/1995 JLB : Created. *
*=============================================================================================*/
bool Is_Speaking(void)
{
Speak_AI();
if (!Debug_Quiet && SampleType != 0 && (SpeakQueue != VOX_NONE || Is_Sample_Playing(SpeechBuffer))) {
return(true);
}
return(false);
}
+26 -2
View File
@@ -303,9 +303,10 @@ void AudMix_Init(void) {
void PlayAudio(AudioBuffer_t& buffer, bool speech) { void PlayAudio(AudioBuffer_t& buffer, bool speech) {
// Only one speech sound can play at once. // Only one speech sound can play at once.
if (speech) { if (speech) {
if (AudMix_IsSourcePlaying(SPEECH_AUDIO_SOURCE)) //if (AudMix_IsSourcePlaying(SPEECH_AUDIO_SOURCE))
return; // return;
alSourceStop(audio_sources[SPEECH_AUDIO_SOURCE]);
alSourcei(audio_sources[SPEECH_AUDIO_SOURCE], AL_BUFFER, buffer.buffer); alSourcei(audio_sources[SPEECH_AUDIO_SOURCE], AL_BUFFER, buffer.buffer);
alSourcePlay(audio_sources[SPEECH_AUDIO_SOURCE]); alSourcePlay(audio_sources[SPEECH_AUDIO_SOURCE]);
return; return;
@@ -360,3 +361,26 @@ void On_Speech(int speech_index, HouseClass* house)
// DLLExportClass::On_Speech(house, speech_index); // DLLExportClass::On_Speech(house, speech_index);
//} //}
} }
/***********************************************************************************************
* Is_Speaking -- Checks to see if the eva voice is still playing. *
* *
* Call this routine when the EVA voice being played needs to be checked. A typical use *
* of this would be when some action needs to be delayed until the voice has finished -- *
* say the end of the game. *
* *
* INPUT: none *
* *
* OUTPUT: bool; Is the EVA voice still playing? *
* *
* WARNINGS: none *
* *
* HISTORY: *
* 03/12/1995 JLB : Created. *
*=============================================================================================*/
bool Is_Speaking(void)
{
Speak_AI();
return AudMix_IsSourcePlaying(SPEECH_AUDIO_SOURCE);
}
+3
View File
@@ -566,6 +566,9 @@ KeyNumType GadgetClass::Input(void)
flags = RIGHTRELEASE; flags = RIGHTRELEASE;
} }
break; break;
case SDL_KEYDOWN:
Keyboard->Put_Element(event.key.keysym.sym);
break;
} }
} }
// jmarshall end // jmarshall end
+6 -7
View File
@@ -86,6 +86,7 @@ class WWKeyboardClass
int MouseQX; int MouseQX;
int MouseQY; int MouseQY;
bool Put_Element(unsigned short val);
private: private:
/* /*
@@ -102,8 +103,7 @@ class WWKeyboardClass
unsigned short Buff_Get(void); unsigned short Buff_Get(void);
unsigned short Fetch_Element(void); unsigned short Fetch_Element(void);
unsigned short Peek_Element(void) const; unsigned short Peek_Element(void) const;
bool Put_Element(unsigned short val);
bool Is_Buffer_Full(void) const; bool Is_Buffer_Full(void) const;
bool Is_Buffer_Empty(void) const; bool Is_Buffer_Empty(void) const;
static bool Is_Mouse_Key(unsigned short key); static bool Is_Mouse_Key(unsigned short key);
@@ -120,7 +120,6 @@ class WWKeyboardClass
int Tail; int Tail;
}; };
#define VK_NONE 0x00 #define VK_NONE 0x00
#define VK_LBUTTON 0x01 #define VK_LBUTTON 0x01
#define VK_RBUTTON 0x02 #define VK_RBUTTON 0x02
@@ -129,8 +128,8 @@ class WWKeyboardClass
#define VK_NONE_05 0x05 #define VK_NONE_05 0x05
#define VK_NONE_06 0x06 #define VK_NONE_06 0x06
#define VK_NONE_07 0x07 #define VK_NONE_07 0x07
#define VK_BACK 0x08 #define VK_BACK '\b'
#define VK_TAB 0x09 #define VK_TAB '\t'
#define VK_NONE_0A 0x0A #define VK_NONE_0A 0x0A
#define VK_NONE_0B 0x0B #define VK_NONE_0B 0x0B
#define VK_CLEAR 0x0C #define VK_CLEAR 0x0C
@@ -148,7 +147,7 @@ class WWKeyboardClass
#define VK_NONE_18 0x18 #define VK_NONE_18 0x18
#define VK_NONE_19 0x19 #define VK_NONE_19 0x19
#define VK_NONE_1A 0x1A #define VK_NONE_1A 0x1A
#define VK_ESCAPE 0x1B #define VK_ESCAPE '\033'
#define VK_NONE_1C 0x1C #define VK_NONE_1C 0x1C
#define VK_NONE_1D 0x1D #define VK_NONE_1D 0x1D
#define VK_NONE_1E 0x1E #define VK_NONE_1E 0x1E
@@ -192,7 +191,7 @@ class WWKeyboardClass
#define VK_E 0x45 #define VK_E 0x45
#define VK_F 0x46 #define VK_F 0x46
#define VK_G 0x47 #define VK_G 0x47
#define VK_H 0x48 #define VK_H 'h'
#define VK_I 0x49 #define VK_I 0x49
#define VK_J 0x4A #define VK_J 0x4A
#define VK_K 0x4B #define VK_K 0x4B
+5
View File
@@ -1340,6 +1340,11 @@ void SidebarClass::StripClass::Reload_LogoShapes(void)
if(PlayerPtr) { if(PlayerPtr) {
houseloaded = PlayerPtr->ActLike; houseloaded = PlayerPtr->ActLike;
} }
// jmarshall
if (houseloaded >= HOUSE_BAD)
return;
// jmarshall end
LogoShapes = (void*)MFCD::Retrieve(stripnames[houseloaded]); LogoShapes = (void*)MFCD::Retrieve(stripnames[houseloaded]);
} }
+1 -1
View File
@@ -111,7 +111,7 @@ class WWKeyboardClass
long Tail; // the tail position in keyboard buffer long Tail; // the tail position in keyboard buffer
int MState; int MState;
int Conditional; int Conditional;
HANDLE CurrentCursor; HANDLE CurrentCursor;
}; };