2016-01-29 12:13:40 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef AGI_TEXT_H
|
|
|
|
#define AGI_TEXT_H
|
|
|
|
|
|
|
|
namespace Agi {
|
|
|
|
|
|
|
|
struct TextPos_Struct {
|
|
|
|
int16 row;
|
|
|
|
int16 column;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define TEXTPOSARRAY_MAX 5
|
|
|
|
|
|
|
|
struct TextAttrib_Struct {
|
|
|
|
byte foreground;
|
|
|
|
byte background;
|
|
|
|
byte combinedForeground;
|
|
|
|
byte combinedBackground;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define TEXTATTRIBARRAY_MAX 5
|
|
|
|
|
|
|
|
struct MessageState_Struct {
|
|
|
|
uint8 type;
|
|
|
|
int16 wanted_Text_Width;
|
|
|
|
TextPos_Struct wanted_TextPos;
|
|
|
|
bool dialogue_Open;
|
|
|
|
uint8 newline_Char;
|
|
|
|
bool window_Active;
|
|
|
|
TextPos_Struct textPos;
|
|
|
|
TextPos_Struct textPos_Edge;
|
|
|
|
int16 textSize_Width;
|
|
|
|
int16 textSize_Height;
|
|
|
|
uint16 printed_Height;
|
2016-02-02 17:43:36 +00:00
|
|
|
|
2016-01-29 12:13:40 +00:00
|
|
|
int16 backgroundPos_x;
|
2016-02-27 20:44:21 +00:00
|
|
|
int16 backgroundPos_y; // original AGI used lowerY here, we use upperY so that upscaling is easier
|
2016-01-29 12:13:40 +00:00
|
|
|
int16 backgroundSize_Width;
|
|
|
|
int16 backgroundSize_Height;
|
|
|
|
};
|
|
|
|
|
|
|
|
// this defines here are for calculating character-size inside the visual-screen!
|
2016-02-02 17:43:36 +00:00
|
|
|
#define FONT_VISUAL_WIDTH 4
|
|
|
|
#define FONT_VISUAL_HEIGHT 8
|
2016-01-29 12:13:40 +00:00
|
|
|
|
2016-02-02 17:43:36 +00:00
|
|
|
#define FONT_DISPLAY_WIDTH 8
|
|
|
|
#define FONT_DISPLAY_HEIGHT 8
|
|
|
|
#define FONT_ROW_CHARACTERS 25
|
|
|
|
#define FONT_COLUMN_CHARACTERS 40
|
|
|
|
#define FONT_BYTES_PER_CHARACTER 8
|
2016-01-29 12:13:40 +00:00
|
|
|
|
2016-02-02 17:43:36 +00:00
|
|
|
#define HEIGHT_MAX 20
|
2016-01-29 12:13:40 +00:00
|
|
|
|
|
|
|
#define TEXT_STRING_MAX_SIZE 40
|
|
|
|
|
|
|
|
class TextMgr {
|
|
|
|
private:
|
|
|
|
Words *_words;
|
|
|
|
GfxMgr *_gfx;
|
|
|
|
AgiEngine *_vm;
|
|
|
|
SystemUI *_systemUI;
|
|
|
|
|
|
|
|
public:
|
|
|
|
TextMgr(AgiEngine *vm, Words *words, GfxMgr *gfx);
|
|
|
|
~TextMgr();
|
|
|
|
|
|
|
|
void init(SystemUI *systemUI);
|
|
|
|
|
|
|
|
TextPos_Struct _textPos;
|
|
|
|
int16 _textPosArrayCount;
|
|
|
|
TextPos_Struct _textPosArray[TEXTPOSARRAY_MAX];
|
|
|
|
|
|
|
|
TextAttrib_Struct _textAttrib;
|
|
|
|
int16 _textAttribArrayCount;
|
|
|
|
TextAttrib_Struct _textAttribArray[TEXTATTRIBARRAY_MAX];
|
|
|
|
|
|
|
|
uint16 _window_Row_Min;
|
|
|
|
uint16 _window_Row_Max;
|
|
|
|
int16 _reset_Column;
|
|
|
|
|
|
|
|
void configureScreen(uint16 row_Min);
|
|
|
|
uint16 getWindowRowMin();
|
|
|
|
|
|
|
|
void dialogueOpen();
|
|
|
|
void dialogueClose();
|
|
|
|
|
|
|
|
void charPos_Clip(int16 &row, int16 &column);
|
|
|
|
void charPos_Set(int16 row, int16 column);
|
|
|
|
void charPos_Set(TextPos_Struct *posPtr);
|
2016-02-01 00:34:36 +00:00
|
|
|
void charPos_Get(int16 &row, int16 &column);
|
|
|
|
void charPos_Get(TextPos_Struct *posPtr);
|
2016-01-29 12:13:40 +00:00
|
|
|
void charPos_Push();
|
|
|
|
void charPos_Pop();
|
|
|
|
void charPos_SetInsideWindow(int16 windowRow, int16 windowColumn);
|
|
|
|
void charAttrib_Set(byte foreground, byte background);
|
|
|
|
byte charAttrib_GetForeground();
|
|
|
|
byte charAttrib_GetBackground();
|
|
|
|
void charAttrib_Push();
|
|
|
|
void charAttrib_Pop();
|
|
|
|
byte calculateTextBackground(byte background);
|
|
|
|
|
|
|
|
void display(int16 textNr, int16 textRow, int16 textColumn);
|
|
|
|
void displayText(const char *textPtr, bool disabledLook = false);
|
|
|
|
void displayCharacter(byte character, bool disabledLook = false);
|
|
|
|
|
|
|
|
void displayTextInsideWindow(const char *textPtr, int16 windowRow, int16 windowColumn);
|
|
|
|
|
|
|
|
MessageState_Struct _messageState;
|
|
|
|
|
|
|
|
void printAt(int16 textNr, int16 textPos_Row, int16 textPos_Column, int16 text_Width);
|
|
|
|
void print(int16 textNr);
|
2016-02-03 00:32:57 +00:00
|
|
|
|
2016-01-29 12:13:40 +00:00
|
|
|
bool messageBox(const char *textPtr);
|
2016-02-03 00:41:32 +00:00
|
|
|
void messageBox_KeyPress(uint16 newKey);
|
2016-02-03 00:32:57 +00:00
|
|
|
|
|
|
|
bool _messageBoxCancelled;
|
|
|
|
|
2016-02-04 11:51:35 +00:00
|
|
|
void drawMessageBox(const char *textPtr, int16 forcedHeight = 0, int16 wantedWidth = 0, bool forcedWidth = false);
|
|
|
|
void getMessageBoxInnerDisplayDimensions(int16 &x, int16 &y, int16 &width, int16 &height);
|
2016-02-04 14:30:50 +00:00
|
|
|
bool isMouseWithinMessageBox();
|
2016-01-29 12:13:40 +00:00
|
|
|
void closeWindow();
|
|
|
|
|
|
|
|
void statusRow_Set(int16 row);
|
|
|
|
int16 statusRow_Get();
|
|
|
|
|
|
|
|
void statusEnable();
|
|
|
|
void statusDisable();
|
|
|
|
bool statusEnabled();
|
|
|
|
|
|
|
|
void statusDraw();
|
|
|
|
void statusClear();
|
|
|
|
|
|
|
|
bool _statusEnabled;
|
|
|
|
int16 _statusRow;
|
|
|
|
|
|
|
|
void clearLine(int16 row, byte color);
|
|
|
|
void clearLines(int16 row_Upper, int16 row_Lower, byte color);
|
|
|
|
void clearBlock(int16 row_Upper, int16 column_Upper, int16 row_Lower, int16 column_Lower, byte color);
|
|
|
|
|
|
|
|
void clearBlockInsideWindow(int16 windowRow, int16 windowColumn, int16 width, byte color);
|
|
|
|
|
|
|
|
bool _inputEditEnabled;
|
|
|
|
byte _inputCursorChar;
|
|
|
|
|
2016-02-28 14:50:25 +00:00
|
|
|
bool _optionCommandPromptWindow;
|
|
|
|
|
2016-01-29 12:13:40 +00:00
|
|
|
bool _promptEnabled;
|
|
|
|
int16 _promptRow;
|
|
|
|
int16 _promptCursorPos;
|
|
|
|
byte _prompt[42];
|
|
|
|
byte _promptPrevious[42];
|
|
|
|
|
|
|
|
bool inputGetEditStatus();
|
|
|
|
void inputEditOn();
|
|
|
|
void inputEditOff();
|
|
|
|
void inputSetCursorChar(int16 cursorChar);
|
|
|
|
byte inputGetCursorChar();
|
|
|
|
|
|
|
|
void promptReset();
|
|
|
|
void promptEnable();
|
|
|
|
void promptDisable();
|
|
|
|
bool promptIsEnabled();
|
|
|
|
|
|
|
|
void promptRow_Set(int16 row);
|
|
|
|
int16 promptRow_Get();
|
2016-02-03 00:41:32 +00:00
|
|
|
void promptKeyPress(uint16 newKey);
|
2016-01-29 12:13:40 +00:00
|
|
|
void promptCancelLine();
|
|
|
|
void promptEchoLine();
|
|
|
|
void promptRedraw();
|
|
|
|
void promptClear(); // for AGI1
|
|
|
|
void promptRememberForAutoComplete(bool entered = false); // for auto-completion
|
|
|
|
|
2016-02-28 14:50:25 +00:00
|
|
|
void promptCommandWindow(bool recallLastCommand, uint16 newKey);
|
|
|
|
|
2016-02-01 00:34:36 +00:00
|
|
|
int16 _inputStringRow;
|
|
|
|
int16 _inputStringColumn;
|
2016-01-29 12:13:40 +00:00
|
|
|
bool _inputStringEntered;
|
|
|
|
int16 _inputStringMaxLen;
|
|
|
|
int16 _inputStringCursorPos;
|
|
|
|
byte _inputString[42];
|
|
|
|
|
|
|
|
bool stringWasEntered();
|
2016-02-01 00:34:36 +00:00
|
|
|
void stringPos_Get(int16 &row, int16 &column);
|
|
|
|
int16 stringGetMaxLen();
|
2016-01-29 12:13:40 +00:00
|
|
|
void stringSet(const char *text);
|
|
|
|
void stringEdit(int16 stringMaxLen);
|
2016-02-03 00:41:32 +00:00
|
|
|
void stringKeyPress(uint16 newKey);
|
2016-01-29 12:13:40 +00:00
|
|
|
void stringRememberForAutoComplete(bool entered = false); // for auto-completion
|
|
|
|
|
|
|
|
char *stringPrintf(const char *originalText);
|
|
|
|
char *stringWordWrap(const char *originalText, int16 maxWidth, int16 *calculatedWidthPtr = nullptr, int16 *calculatedHeightPtr = nullptr);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Agi
|
|
|
|
|
|
|
|
#endif /* AGI_TEXT_H */
|