TRECISION: Move some utils functions to the main class, fix a variable shadowed in read
+ some renaming, fix some missing default cases in switches
This commit is contained in:
parent
18e3eb55b7
commit
22ef714b98
14 changed files with 116 additions and 111 deletions
|
@ -218,7 +218,6 @@ void initSortPan();
|
||||||
int panCompare(const void *arg1, const void *arg2);
|
int panCompare(const void *arg1, const void *arg2);
|
||||||
void sortPanel();
|
void sortPanel();
|
||||||
void actorOrder();
|
void actorOrder();
|
||||||
char waitKey();
|
|
||||||
|
|
||||||
} // End of namespace Trecision
|
} // End of namespace Trecision
|
||||||
|
|
||||||
|
|
|
@ -373,7 +373,7 @@ void doSystem() {
|
||||||
/* doIdle */
|
/* doIdle */
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
void doIdle() {
|
void doIdle() {
|
||||||
char c = GetKey();
|
char c = g_vm->GetKey();
|
||||||
switch (c) {
|
switch (c) {
|
||||||
// Quit
|
// Quit
|
||||||
case 'q':
|
case 'q':
|
||||||
|
|
|
@ -38,7 +38,7 @@ int16 CurPos, LastPos;
|
||||||
|
|
||||||
void DialogPrint(int x, int y, int c, const char *txt) {
|
void DialogPrint(int x, int y, int c, const char *txt) {
|
||||||
SDText curChoice;
|
SDText curChoice;
|
||||||
curChoice.set(x, y, TextLength(txt, 0), 0, 0, 0, MAXX, MAXY, c, MASKCOL, txt);
|
curChoice.set(x, y, g_vm->TextLength(txt, 0), 0, 0, 0, MAXX, MAXY, c, MASKCOL, txt);
|
||||||
curChoice.DText();
|
curChoice.DText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,7 +241,10 @@ void afterChoice(int numframe) {
|
||||||
g_vm->_obj[oCHIAVI54]._mode |= OBJMODE_OBJSTATUS;
|
g_vm->_obj[oCHIAVI54]._mode |= OBJMODE_OBJSTATUS;
|
||||||
g_vm->_obj[od54ALLA55]._mode |= OBJMODE_OBJSTATUS;
|
g_vm->_obj[od54ALLA55]._mode |= OBJMODE_OBJSTATUS;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the player chose to exit the dialog
|
// If the player chose to exit the dialog
|
||||||
if (g_vm->_choice[_curChoice]._flag & DLGCHOICE_EXITDLG) {
|
if (g_vm->_choice[_curChoice]._flag & DLGCHOICE_EXITDLG) {
|
||||||
g_vm->_animMgr->stopFullMotion();
|
g_vm->_animMgr->stopFullMotion();
|
||||||
|
@ -487,6 +490,9 @@ void afterChoice(int numframe) {
|
||||||
case dFCRED:
|
case dFCRED:
|
||||||
doEvent(MC_SYSTEM, ME_QUIT, MP_SYSTEM, 0, 0, 0, 0);
|
doEvent(MC_SYSTEM, ME_QUIT, MP_SYSTEM, 0, 0, 0, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -332,7 +332,6 @@ void doScript() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* -----------------26/11/97 10.38-------------------
|
/* -----------------26/11/97 10.38-------------------
|
||||||
* GestioneATFrame
|
* GestioneATFrame
|
||||||
* --------------------------------------------------*/
|
* --------------------------------------------------*/
|
||||||
|
|
|
@ -50,8 +50,8 @@ extern struct SSortTable SortTable[];
|
||||||
/* VARIE */
|
/* VARIE */
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
extern uint32 TheTime;
|
extern uint32 TheTime;
|
||||||
extern uint32 CharacterSpeakTime;
|
extern uint32 _characterSpeakTime;
|
||||||
extern uint32 SomeOneSpeakTime;
|
extern uint32 _someoneSpeakTime;
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
/* DIALOGHI */
|
/* DIALOGHI */
|
||||||
|
|
|
@ -49,8 +49,8 @@ SSortTable SortTable[200];
|
||||||
/* VARIE */
|
/* VARIE */
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
uint32 TheTime;
|
uint32 TheTime;
|
||||||
uint32 CharacterSpeakTime;
|
uint32 _characterSpeakTime;
|
||||||
uint32 SomeOneSpeakTime;
|
uint32 _someoneSpeakTime;
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
/* DIALOGHI */
|
/* DIALOGHI */
|
||||||
|
|
|
@ -106,7 +106,6 @@ extern uint8 TextStatus;
|
||||||
int Compare(const void *p1, const void *p2);
|
int Compare(const void *p1, const void *p2);
|
||||||
void RedrawRoom();
|
void RedrawRoom();
|
||||||
void FreeKey();
|
void FreeKey();
|
||||||
uint16 TextLength(const char *text, uint16 num);
|
|
||||||
bool DataSave();
|
bool DataSave();
|
||||||
bool DataLoad();
|
bool DataLoad();
|
||||||
bool QuitGame();
|
bool QuitGame();
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
#include "common/scummsys.h"
|
#include "common/scummsys.h"
|
||||||
#include "common/translation.h"
|
#include "common/translation.h"
|
||||||
#include "common/config-manager.h"
|
#include "common/config-manager.h"
|
||||||
|
@ -43,22 +45,6 @@ namespace Trecision {
|
||||||
|
|
||||||
uint16 BlinkLastDTextChar = MASKCOL;
|
uint16 BlinkLastDTextChar = MASKCOL;
|
||||||
|
|
||||||
/*-----------------17/02/95 09.53-------------------
|
|
||||||
TextLength - Compute string length from character 0 to num
|
|
||||||
--------------------------------------------------*/
|
|
||||||
uint16 TextLength(const char *text, uint16 num) {
|
|
||||||
if (text == nullptr)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
uint16 len = (num == 0) ? strlen(text) : num;
|
|
||||||
|
|
||||||
uint16 retVal = 0;
|
|
||||||
for (uint16 c = 0; c < len; c++)
|
|
||||||
retVal += g_vm->_font[(uint8)text[c] * 3 + 2];
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SDText::set(SDText org) {
|
void SDText::set(SDText org) {
|
||||||
set(org.x, org.y, org.dx, org.dy, org._subtitleRect.left, org._subtitleRect.top, org._subtitleRect.right, org._subtitleRect.bottom, org.tcol, org.scol, org.text);
|
set(org.x, org.y, org.dx, org.dy, org._subtitleRect.left, org._subtitleRect.top, org._subtitleRect.right, org._subtitleRect.bottom, org.tcol, org.scol, org.text);
|
||||||
}
|
}
|
||||||
|
@ -88,7 +74,7 @@ uint16 SDText::checkDText() {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
uint8 curLine = 0;
|
uint8 curLine = 0;
|
||||||
if (TextLength(text, 0) <= dx) {
|
if (g_vm->TextLength(text, 0) <= dx) {
|
||||||
strcpy((char *)DTextLines[curLine], text);
|
strcpy((char *)DTextLines[curLine], text);
|
||||||
return CARHEI;
|
return CARHEI;
|
||||||
}
|
}
|
||||||
|
@ -101,9 +87,9 @@ uint16 SDText::checkDText() {
|
||||||
while (a < strlen(text)) {
|
while (a < strlen(text)) {
|
||||||
a++;
|
a++;
|
||||||
if (text[a] == ' ') {
|
if (text[a] == ' ') {
|
||||||
if (TextLength(text + curInit, a - curInit) <= dx)
|
if (g_vm->TextLength(text + curInit, a - curInit) <= dx)
|
||||||
lastSpace = a;
|
lastSpace = a;
|
||||||
else if (TextLength(text + curInit, lastSpace - curInit) <= dx) {
|
else if (g_vm->TextLength(text + curInit, lastSpace - curInit) <= dx) {
|
||||||
uint16 b;
|
uint16 b;
|
||||||
for (b = curInit; b < lastSpace; b++)
|
for (b = curInit; b < lastSpace; b++)
|
||||||
DTextLines[curLine][b - curInit] = text[b];
|
DTextLines[curLine][b - curInit] = text[b];
|
||||||
|
@ -118,7 +104,7 @@ uint16 SDText::checkDText() {
|
||||||
} else
|
} else
|
||||||
return 0;
|
return 0;
|
||||||
} else if (text[a] == '\0') {
|
} else if (text[a] == '\0') {
|
||||||
if (TextLength(text + curInit, a - curInit) <= dx) {
|
if (g_vm->TextLength(text + curInit, a - curInit) <= dx) {
|
||||||
uint16 b;
|
uint16 b;
|
||||||
for (b = curInit; b < a; b++)
|
for (b = curInit; b < a; b++)
|
||||||
DTextLines[curLine][b - curInit] = text[b];
|
DTextLines[curLine][b - curInit] = text[b];
|
||||||
|
@ -129,7 +115,7 @@ uint16 SDText::checkDText() {
|
||||||
return tmpDy;
|
return tmpDy;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TextLength(text + curInit, lastSpace - curInit) <= dx) {
|
if (g_vm->TextLength(text + curInit, lastSpace - curInit) <= dx) {
|
||||||
uint16 b;
|
uint16 b;
|
||||||
for (b = curInit; b < lastSpace; b++)
|
for (b = curInit; b < lastSpace; b++)
|
||||||
DTextLines[curLine][b - curInit] = text[b];
|
DTextLines[curLine][b - curInit] = text[b];
|
||||||
|
@ -173,17 +159,17 @@ void SDText::DText(uint16 *frameBuffer) {
|
||||||
uint16 curDy = checkDText();
|
uint16 curDy = checkDText();
|
||||||
|
|
||||||
for (uint16 b = 0; b < (curDy / CARHEI); b++) {
|
for (uint16 b = 0; b < (curDy / CARHEI); b++) {
|
||||||
char *text = (char *)DTextLines[b];
|
char *curText = (char *)DTextLines[b];
|
||||||
uint16 inc = (dx - TextLength(text, 0)) / 2;
|
uint16 inc = (dx - g_vm->TextLength(curText, 0)) / 2;
|
||||||
uint16 len = strlen(text);
|
uint16 len = strlen(curText);
|
||||||
|
|
||||||
if (len >= MAXCHARS) {
|
if (len >= MAXCHARS) {
|
||||||
strcpy(text, g_vm->_sysText[kMessageError]);
|
strcpy(curText, g_vm->_sysText[kMessageError]);
|
||||||
len = strlen(text);
|
len = strlen(curText);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint16 c = 0; c < len; c++) {
|
for (uint16 c = 0; c < len; c++) {
|
||||||
byte curChar = text[c]; /* legge prima parte del font */
|
byte curChar = curText[c]; /* legge prima parte del font */
|
||||||
|
|
||||||
const uint16 charOffset = g_vm->_font[curChar * 3] + (uint16)(g_vm->_font[curChar * 3 + 1] << 8);
|
const uint16 charOffset = g_vm->_font[curChar * 3] + (uint16)(g_vm->_font[curChar * 3 + 1] << 8);
|
||||||
uint16 fontDataOffset = 768;
|
uint16 fontDataOffset = 768;
|
||||||
|
@ -383,7 +369,7 @@ insave:
|
||||||
for (;;) {
|
for (;;) {
|
||||||
g_vm->checkSystem();
|
g_vm->checkSystem();
|
||||||
|
|
||||||
GetKey();
|
g_vm->GetKey();
|
||||||
|
|
||||||
int16 mx = g_vm->_mouseX;
|
int16 mx = g_vm->_mouseX;
|
||||||
int16 my = g_vm->_mouseY;
|
int16 my = g_vm->_mouseY;
|
||||||
|
@ -400,7 +386,7 @@ insave:
|
||||||
memset(g_vm->_screenBuffer + MAXX * a, 0, MAXX * 2);
|
memset(g_vm->_screenBuffer + MAXX * a, 0, MAXX * 2);
|
||||||
|
|
||||||
posx = ICONMARGSX + ((CurPos) * (ICONDX)) + ICONDX / 2;
|
posx = ICONMARGSX + ((CurPos) * (ICONDX)) + ICONDX / 2;
|
||||||
LenText = TextLength(saveNames[CurPos].c_str(), 0);
|
LenText = g_vm->TextLength(saveNames[CurPos].c_str(), 0);
|
||||||
|
|
||||||
posx = CLIP(posx - (LenText / 2), 2, MAXX - 2 - LenText);
|
posx = CLIP(posx - (LenText / 2), 2, MAXX - 2 - LenText);
|
||||||
SText.set(posx, FIRSTLINE + ICONDY + 10, LenText, CARHEI, 0, 0, LenText, CARHEI, 0x7FFF, MASKCOL, saveNames[CurPos].c_str());
|
SText.set(posx, FIRSTLINE + ICONDY + 10, LenText, CARHEI, 0, 0, LenText, CARHEI, 0x7FFF, MASKCOL, saveNames[CurPos].c_str());
|
||||||
|
@ -442,7 +428,7 @@ insave:
|
||||||
for (;;) {
|
for (;;) {
|
||||||
g_vm->_keybInput = true;
|
g_vm->_keybInput = true;
|
||||||
g_vm->checkSystem();
|
g_vm->checkSystem();
|
||||||
ch = GetKey();
|
ch = g_vm->GetKey();
|
||||||
FreeKey();
|
FreeKey();
|
||||||
|
|
||||||
g_vm->_keybInput = false;
|
g_vm->_keybInput = false;
|
||||||
|
@ -470,7 +456,7 @@ insave:
|
||||||
saveNames[CurPos] += '_'; // add blinking cursor
|
saveNames[CurPos] += '_'; // add blinking cursor
|
||||||
|
|
||||||
posx = ICONMARGSX + ((CurPos) * (ICONDX)) + ICONDX / 2;
|
posx = ICONMARGSX + ((CurPos) * (ICONDX)) + ICONDX / 2;
|
||||||
LenText = TextLength(saveNames[CurPos].c_str(), 0);
|
LenText = g_vm->TextLength(saveNames[CurPos].c_str(), 0);
|
||||||
|
|
||||||
posx = CLIP(posx - (LenText / 2), 2, MAXX - 2 - LenText);
|
posx = CLIP(posx - (LenText / 2), 2, MAXX - 2 - LenText);
|
||||||
SText.set(posx, FIRSTLINE + ICONDY + 10, LenText, CARHEI, 0, 0, LenText, CARHEI, 0x7FFF, MASKCOL, saveNames[CurPos].c_str());
|
SText.set(posx, FIRSTLINE + ICONDY + 10, LenText, CARHEI, 0, 0, LenText, CARHEI, 0x7FFF, MASKCOL, saveNames[CurPos].c_str());
|
||||||
|
@ -580,8 +566,7 @@ bool DataLoad() {
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
g_vm->checkSystem();
|
g_vm->checkSystem();
|
||||||
|
g_vm->GetKey();
|
||||||
GetKey();
|
|
||||||
|
|
||||||
if (g_vm->_mouseY >= FIRSTLINE &&
|
if (g_vm->_mouseY >= FIRSTLINE &&
|
||||||
g_vm->_mouseY < (FIRSTLINE + ICONDY) &&
|
g_vm->_mouseY < (FIRSTLINE + ICONDY) &&
|
||||||
|
@ -595,7 +580,7 @@ bool DataLoad() {
|
||||||
memset(g_vm->_screenBuffer + MAXX * a, 0, MAXX * 2);
|
memset(g_vm->_screenBuffer + MAXX * a, 0, MAXX * 2);
|
||||||
|
|
||||||
uint16 posX = ICONMARGSX + ((CurPos) * (ICONDX)) + ICONDX / 2;
|
uint16 posX = ICONMARGSX + ((CurPos) * (ICONDX)) + ICONDX / 2;
|
||||||
uint16 lenText = TextLength(saveNames[CurPos].c_str(), 0);
|
uint16 lenText = g_vm->TextLength(saveNames[CurPos].c_str(), 0);
|
||||||
if (posX - (lenText / 2) < 2)
|
if (posX - (lenText / 2) < 2)
|
||||||
posX = 2;
|
posX = 2;
|
||||||
else
|
else
|
||||||
|
@ -697,7 +682,7 @@ bool QuitGame() {
|
||||||
|
|
||||||
g_vm->checkSystem();
|
g_vm->checkSystem();
|
||||||
|
|
||||||
char ch = waitKey();
|
char ch = g_vm->waitKey();
|
||||||
|
|
||||||
bool exitFl = ((ch == 'y') || (ch == 'Y'));
|
bool exitFl = ((ch == 'y') || (ch == 'Y'));
|
||||||
|
|
||||||
|
@ -723,9 +708,7 @@ void DemoOver() {
|
||||||
g_vm->_graphicsMgr->copyToScreen(0, 0, MAXX, TOP);
|
g_vm->_graphicsMgr->copyToScreen(0, 0, MAXX, TOP);
|
||||||
|
|
||||||
FreeKey();
|
FreeKey();
|
||||||
|
g_vm->waitKey();
|
||||||
waitKey();
|
|
||||||
|
|
||||||
g_vm->quitGame();
|
g_vm->quitGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,9 +88,8 @@ void CharacterContinueTalk();
|
||||||
void CharacterMute();
|
void CharacterMute();
|
||||||
void SomeoneTalk(uint16 s, uint16 Person, uint16 NewAnim, bool FromSomeOneSay);
|
void SomeoneTalk(uint16 s, uint16 Person, uint16 NewAnim, bool FromSomeOneSay);
|
||||||
void SomeoneContinueTalk();
|
void SomeoneContinueTalk();
|
||||||
void SomeOneMute();
|
void someoneMute();
|
||||||
void doString();
|
void doString();
|
||||||
char GetKey();
|
|
||||||
void soundtimefunct();
|
void soundtimefunct();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -56,7 +56,7 @@ const char *dunno = "?";
|
||||||
/* PositionString */
|
/* PositionString */
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
void PositionString(uint16 x, uint16 y, const char *string, uint16 *posx, uint16 *posy, bool characterFl) {
|
void PositionString(uint16 x, uint16 y, const char *string, uint16 *posx, uint16 *posy, bool characterFl) {
|
||||||
uint16 lenText = TextLength(string, 0);
|
uint16 lenText = g_vm->TextLength(string, 0);
|
||||||
if (lenText > 960)
|
if (lenText > 960)
|
||||||
lenText = (lenText * 2 / 5);
|
lenText = (lenText * 2 / 5);
|
||||||
else if (lenText > 320)
|
else if (lenText > 320)
|
||||||
|
@ -118,7 +118,7 @@ void ShowObjName(uint16 obj, bool showhide) {
|
||||||
}
|
}
|
||||||
|
|
||||||
g_vm->_lastObj = (obj | 0x8000);
|
g_vm->_lastObj = (obj | 0x8000);
|
||||||
uint16 lenText = TextLength(locsent.c_str(), 0);
|
uint16 lenText = g_vm->TextLength(locsent.c_str(), 0);
|
||||||
|
|
||||||
posx = CLIP(320 - (lenText / 2), 2, MAXX - 2 - lenText);
|
posx = CLIP(320 - (lenText / 2), 2, MAXX - 2 - lenText);
|
||||||
posy = MAXY - CARHEI;
|
posy = MAXY - CARHEI;
|
||||||
|
@ -267,7 +267,7 @@ void CharacterTalkInAction(uint16 ss) {
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
void CharacterContinueTalk() {
|
void CharacterContinueTalk() {
|
||||||
g_vm->_flagSkipTalk = false;
|
g_vm->_flagSkipTalk = false;
|
||||||
CharacterSpeakTime = TheTime;
|
_characterSpeakTime = TheTime;
|
||||||
|
|
||||||
substringagain = (CurSubString < (SubStringUsed - 1));
|
substringagain = (CurSubString < (SubStringUsed - 1));
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ void CharacterMute() {
|
||||||
g_vm->_flagSomeoneSpeaks = false;
|
g_vm->_flagSomeoneSpeaks = false;
|
||||||
g_vm->_flagCharacterSpeak = false;
|
g_vm->_flagCharacterSpeak = false;
|
||||||
g_vm->_flagSkipTalk = false;
|
g_vm->_flagSkipTalk = false;
|
||||||
CharacterSpeakTime = 0L;
|
_characterSpeakTime = 0L;
|
||||||
|
|
||||||
g_vm->clearText();
|
g_vm->clearText();
|
||||||
g_vm->_lastObj = 0;
|
g_vm->_lastObj = 0;
|
||||||
|
@ -348,7 +348,7 @@ void SomeoneTalk(uint16 s, uint16 Person, uint16 NewAnim, bool FromSomeOneSay) {
|
||||||
void SomeoneContinueTalk() {
|
void SomeoneContinueTalk() {
|
||||||
uint16 posx, posy;
|
uint16 posx, posy;
|
||||||
|
|
||||||
SomeOneSpeakTime = TheTime;
|
_someoneSpeakTime = TheTime;
|
||||||
g_vm->_flagSkipTalk = false;
|
g_vm->_flagSkipTalk = false;
|
||||||
|
|
||||||
substringagain = (CurSubString < (SubStringUsed - 1));
|
substringagain = (CurSubString < (SubStringUsed - 1));
|
||||||
|
@ -376,13 +376,13 @@ void SomeoneContinueTalk() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
/* SomeOneMute */
|
/* someoneMute */
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
void SomeOneMute() {
|
void someoneMute() {
|
||||||
g_vm->_flagCharacterSpeak = false;
|
g_vm->_flagCharacterSpeak = false;
|
||||||
g_vm->_flagSkipTalk = false;
|
g_vm->_flagSkipTalk = false;
|
||||||
g_vm->_flagSomeoneSpeaks = false;
|
g_vm->_flagSomeoneSpeaks = false;
|
||||||
SomeOneSpeakTime = 0L;
|
_someoneSpeakTime = 0;
|
||||||
|
|
||||||
g_vm->clearText();
|
g_vm->clearText();
|
||||||
g_vm->_lastObj = 0;
|
g_vm->_lastObj = 0;
|
||||||
|
@ -403,7 +403,7 @@ void doString() {
|
||||||
|
|
||||||
case ME_CHARACTERSPEAKING:
|
case ME_CHARACTERSPEAKING:
|
||||||
if (g_vm->_flagCharacterSpeak) {
|
if (g_vm->_flagCharacterSpeak) {
|
||||||
if (g_vm->_flagSkipTalk || (TheTime > TalkTime + CharacterSpeakTime)) {
|
if (g_vm->_flagSkipTalk || (TheTime > TalkTime + _characterSpeakTime)) {
|
||||||
if (substringagain)
|
if (substringagain)
|
||||||
CharacterContinueTalk();
|
CharacterContinueTalk();
|
||||||
else
|
else
|
||||||
|
@ -422,14 +422,14 @@ void doString() {
|
||||||
|
|
||||||
case ME_SOMEONEWAIT2MUTE:
|
case ME_SOMEONEWAIT2MUTE:
|
||||||
if (!g_vm->_curMessage->_u16Param1)
|
if (!g_vm->_curMessage->_u16Param1)
|
||||||
SomeOneMute();
|
someoneMute();
|
||||||
else
|
else
|
||||||
REEVENT;
|
REEVENT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ME_SOMEONESPEAKING:
|
case ME_SOMEONESPEAKING:
|
||||||
if (g_vm->_flagSomeoneSpeaks) {
|
if (g_vm->_flagSomeoneSpeaks) {
|
||||||
if (g_vm->_flagSkipTalk || (TheTime >= (TalkTime + SomeOneSpeakTime))) {
|
if (g_vm->_flagSkipTalk || (TheTime >= (TalkTime + _someoneSpeakTime))) {
|
||||||
if (substringagain)
|
if (substringagain)
|
||||||
SomeoneContinueTalk();
|
SomeoneContinueTalk();
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -30,51 +30,6 @@
|
||||||
|
|
||||||
namespace Trecision {
|
namespace Trecision {
|
||||||
|
|
||||||
/*-----------------16/01/97 20.53-------------------
|
|
||||||
GetKey
|
|
||||||
--------------------------------------------------*/
|
|
||||||
char GetKey() {
|
|
||||||
Common::KeyCode key = g_vm->_curKey;
|
|
||||||
uint16 ascii = g_vm->_curAscii;
|
|
||||||
g_vm->_curKey = Common::KEYCODE_INVALID;
|
|
||||||
g_vm->_curAscii = 0;
|
|
||||||
|
|
||||||
switch (key) {
|
|
||||||
case Common::KEYCODE_SPACE:
|
|
||||||
case Common::KEYCODE_ESCAPE:
|
|
||||||
case Common::KEYCODE_RETURN:
|
|
||||||
case Common::KEYCODE_CLEAR:
|
|
||||||
case Common::KEYCODE_BACKSPACE:
|
|
||||||
return key;
|
|
||||||
case Common::KEYCODE_F1:
|
|
||||||
case Common::KEYCODE_F2:
|
|
||||||
case Common::KEYCODE_F3:
|
|
||||||
case Common::KEYCODE_F4:
|
|
||||||
case Common::KEYCODE_F5:
|
|
||||||
case Common::KEYCODE_F6:
|
|
||||||
return 0x3B + key - Common::KEYCODE_F1;
|
|
||||||
default:
|
|
||||||
if (ascii) {
|
|
||||||
return ascii;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*-----------------17/01/97 11.17-------------------
|
|
||||||
waitKey
|
|
||||||
--------------------------------------------------*/
|
|
||||||
char waitKey() {
|
|
||||||
while (g_vm->_curKey == Common::KEYCODE_INVALID)
|
|
||||||
g_vm->checkSystem();
|
|
||||||
|
|
||||||
Common::KeyCode t = g_vm->_curKey;
|
|
||||||
g_vm->_curKey = Common::KEYCODE_INVALID;
|
|
||||||
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*-----------------17/01/97 11.18-------------------
|
/*-----------------17/01/97 11.18-------------------
|
||||||
FreeKey
|
FreeKey
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "common/system.h"
|
#include "common/system.h"
|
||||||
#include "audio/decoders/wave.h"
|
#include "audio/decoders/wave.h"
|
||||||
#include "audio/audiostream.h"
|
#include "audio/audiostream.h"
|
||||||
|
#include "trecision/nl/extern.h"
|
||||||
|
|
||||||
namespace Trecision {
|
namespace Trecision {
|
||||||
|
|
||||||
|
@ -331,9 +332,8 @@ int32 Talk(const char *name) {
|
||||||
|
|
||||||
Audio::SeekableAudioStream *speechStream = Audio::makeWAVStream(stream, DisposeAfterUse::YES);
|
Audio::SeekableAudioStream *speechStream = Audio::makeWAVStream(stream, DisposeAfterUse::YES);
|
||||||
|
|
||||||
extern uint32 CharacterSpeakTime;
|
|
||||||
g_system->getMixer()->playStream(Audio::Mixer::kSpeechSoundType, &soundHandle[kSoundChannelSpeech], speechStream);
|
g_system->getMixer()->playStream(Audio::Mixer::kSpeechSoundType, &soundHandle[kSoundChannelSpeech], speechStream);
|
||||||
CharacterSpeakTime = ReadTime();
|
_characterSpeakTime = ReadTime();
|
||||||
|
|
||||||
return TIME(speechStream->getLength().msecs());
|
return TIME(speechStream->getLength().msecs());
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,6 +105,9 @@ public:
|
||||||
// Utils
|
// Utils
|
||||||
char *getNextSentence();
|
char *getNextSentence();
|
||||||
void setRoom(uint16 r, bool b);
|
void setRoom(uint16 r, bool b);
|
||||||
|
uint16 TextLength(const char *text, uint16 num);
|
||||||
|
char GetKey();
|
||||||
|
char waitKey();
|
||||||
|
|
||||||
// Text
|
// Text
|
||||||
void addText(uint16 x, uint16 y, const char *text, uint16 tcol, uint16 scol);
|
void addText(uint16 x, uint16 y, const char *text, uint16 tcol, uint16 scol);
|
||||||
|
|
|
@ -108,11 +108,11 @@ void TrecisionEngine::drawString() {
|
||||||
/* redrawString */
|
/* redrawString */
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
void TrecisionEngine::redrawString() {
|
void TrecisionEngine::redrawString() {
|
||||||
if (!_flagDialogActive && !_flagDialogMenuActive && !_flagSomeoneSpeaks && !_flagscriptactive && g_vm->isCursorVisible()) {
|
if (!_flagDialogActive && !_flagDialogMenuActive && !_flagSomeoneSpeaks && !_flagscriptactive && isCursorVisible()) {
|
||||||
if (isInventoryArea(g_vm->_mouseY))
|
if (isInventoryArea(_mouseY))
|
||||||
doEvent(MC_INVENTORY, ME_SHOWICONNAME, MP_DEFAULT, 0, 0, 0, 0);
|
doEvent(MC_INVENTORY, ME_SHOWICONNAME, MP_DEFAULT, 0, 0, 0, 0);
|
||||||
else {
|
else {
|
||||||
CheckMask(g_vm->_mouseX, g_vm->_mouseY);
|
CheckMask(_mouseX, _mouseY);
|
||||||
ShowObjName(_curObj, true);
|
ShowObjName(_curObj, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ void TrecisionEngine::redrawString() {
|
||||||
void StackText::doText() {
|
void StackText::doText() {
|
||||||
curString.x = x;
|
curString.x = x;
|
||||||
curString.y = y;
|
curString.y = y;
|
||||||
curString.dx = TextLength(text, 0);
|
curString.dx = g_vm->TextLength(text, 0);
|
||||||
if ((y == MAXY - CARHEI) && (curString.dx > 600))
|
if ((y == MAXY - CARHEI) && (curString.dx > 600))
|
||||||
curString.dx = curString.dx * 3 / 5;
|
curString.dx = curString.dx * 3 / 5;
|
||||||
else if ((y != MAXY - CARHEI) && (curString.dx > 960))
|
else if ((y != MAXY - CARHEI) && (curString.dx > 960))
|
||||||
|
@ -173,4 +173,66 @@ void TrecisionEngine::setRoom(uint16 r, bool b) {
|
||||||
RegenRoom();
|
RegenRoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*-----------------17/02/95 09.53-------------------
|
||||||
|
TextLength - Compute string length from character 0 to num
|
||||||
|
--------------------------------------------------*/
|
||||||
|
uint16 TrecisionEngine::TextLength(const char *text, uint16 num) {
|
||||||
|
if (text == nullptr)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
uint16 len = (num == 0) ? strlen(text) : num;
|
||||||
|
|
||||||
|
uint16 retVal = 0;
|
||||||
|
for (uint16 c = 0; c < len; c++)
|
||||||
|
retVal += _font[(uint8)text[c] * 3 + 2];
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------16/01/97 20.53-------------------
|
||||||
|
GetKey
|
||||||
|
--------------------------------------------------*/
|
||||||
|
char TrecisionEngine::GetKey() {
|
||||||
|
Common::KeyCode key = _curKey;
|
||||||
|
uint16 ascii = _curAscii;
|
||||||
|
_curKey = Common::KEYCODE_INVALID;
|
||||||
|
_curAscii = 0;
|
||||||
|
|
||||||
|
switch (key) {
|
||||||
|
case Common::KEYCODE_SPACE:
|
||||||
|
case Common::KEYCODE_ESCAPE:
|
||||||
|
case Common::KEYCODE_RETURN:
|
||||||
|
case Common::KEYCODE_CLEAR:
|
||||||
|
case Common::KEYCODE_BACKSPACE:
|
||||||
|
return key;
|
||||||
|
case Common::KEYCODE_F1:
|
||||||
|
case Common::KEYCODE_F2:
|
||||||
|
case Common::KEYCODE_F3:
|
||||||
|
case Common::KEYCODE_F4:
|
||||||
|
case Common::KEYCODE_F5:
|
||||||
|
case Common::KEYCODE_F6:
|
||||||
|
return 0x3B + key - Common::KEYCODE_F1;
|
||||||
|
default:
|
||||||
|
if (ascii) {
|
||||||
|
return ascii;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-----------------17/01/97 11.17-------------------
|
||||||
|
waitKey
|
||||||
|
--------------------------------------------------*/
|
||||||
|
char TrecisionEngine::waitKey() {
|
||||||
|
while (_curKey == Common::KEYCODE_INVALID)
|
||||||
|
checkSystem();
|
||||||
|
|
||||||
|
Common::KeyCode t = _curKey;
|
||||||
|
_curKey = Common::KEYCODE_INVALID;
|
||||||
|
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // End of namespace Trecision
|
} // End of namespace Trecision
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue