2020-10-14 15:16:30 +02: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 TWINE_TEXT_H
|
|
|
|
#define TWINE_TEXT_H
|
|
|
|
|
|
|
|
#include "common/scummsys.h"
|
|
|
|
#include "common/str.h"
|
|
|
|
|
|
|
|
namespace TwinE {
|
|
|
|
|
2020-11-01 22:25:16 +01:00
|
|
|
// lba1
|
|
|
|
enum class TextBankId {
|
|
|
|
None = -1,
|
|
|
|
Options_and_menus = 0,
|
|
|
|
Credits = 1,
|
|
|
|
Inventory_Intro_and_Holomap = 2,
|
|
|
|
Citadel_Island = 3,
|
|
|
|
Principal_Island = 4,
|
|
|
|
White_Leaf_Desert = 5,
|
|
|
|
Proxima_Island = 6,
|
|
|
|
Rebellion_Island = 7,
|
|
|
|
Hamalayi_mountains_southern_range = 8,
|
|
|
|
Hamalayi_mountains_northern_range = 9,
|
|
|
|
Tippet_Island = 10,
|
|
|
|
Brundle_Island = 11,
|
|
|
|
Fortress_Island = 12,
|
|
|
|
Polar_Island = 13
|
|
|
|
};
|
|
|
|
|
2020-10-14 15:16:30 +02:00
|
|
|
class TwinEEngine;
|
|
|
|
class Text {
|
|
|
|
private:
|
|
|
|
TwinEEngine *_engine;
|
|
|
|
void initVoxBank(int32 bankIdx);
|
|
|
|
/**
|
|
|
|
* Draw a certain character in the screen
|
|
|
|
* @param x X coordinate in screen
|
|
|
|
* @param y Y coordinate in screen
|
|
|
|
* @param character ascii character to display
|
|
|
|
*/
|
|
|
|
void drawCharacter(int32 x, int32 y, uint8 character);
|
|
|
|
/**
|
|
|
|
* Draw character with shadow
|
|
|
|
* @param x X coordinate in screen
|
|
|
|
* @param y Y coordinate in screen
|
|
|
|
* @param character ascii character to display
|
|
|
|
* @param color character color
|
|
|
|
*/
|
|
|
|
void drawCharacterShadow(int32 x, int32 y, uint8 character, int32 color);
|
|
|
|
void initProgressiveTextBuffer();
|
|
|
|
void printText8Sub4(int16 a, int16 b, int16 c);
|
|
|
|
struct WordSize {
|
|
|
|
int32 inChar = 0;
|
|
|
|
int32 inPixel = 0;
|
|
|
|
};
|
|
|
|
WordSize getWordSize(const char *arg1, char *arg2);
|
|
|
|
void processTextLine();
|
|
|
|
// draw next page arrow polygon
|
|
|
|
void printText10Sub();
|
|
|
|
void printText10Sub2();
|
2020-10-26 22:33:43 +01:00
|
|
|
int32 getCharWidth(uint8 chr) const;
|
2020-10-27 16:45:56 +01:00
|
|
|
int32 getCharHeight(uint8 chr) const;
|
2020-10-14 15:16:30 +02:00
|
|
|
/**
|
|
|
|
* Copy dialogue text
|
|
|
|
* @param src source text buffer
|
|
|
|
* @param dst destination text buffer
|
|
|
|
* @param size text size
|
|
|
|
*/
|
|
|
|
void copyText(const char *src, char *dst, int32 size);
|
|
|
|
|
|
|
|
// RECHECK THIS LATER
|
|
|
|
int32 currentBankIdx = -1; // textVar1
|
2020-10-24 17:34:25 +02:00
|
|
|
char textVar2[256] {'\0'};
|
2020-10-14 15:16:30 +02:00
|
|
|
|
|
|
|
/** Dialogue text pointer */
|
|
|
|
char *dialTextPtr = nullptr; // bufText
|
|
|
|
/** Dialogue entry order pointer */
|
|
|
|
char *dialOrderPtr = nullptr; // bufOrder
|
|
|
|
/** Number of dialogues text entries */
|
|
|
|
int16 numDialTextEntries = 0;
|
|
|
|
|
|
|
|
const int16 spaceChar = 0x20;
|
|
|
|
|
|
|
|
// TODO: refactor all this variables and related functions
|
2020-10-24 17:34:25 +02:00
|
|
|
char buf1[256] {'\0'};
|
|
|
|
char buf2[256] {'\0'};
|
2020-10-14 15:16:30 +02:00
|
|
|
char *printText8Ptr1 = nullptr;
|
|
|
|
char *printText8Ptr2 = nullptr;
|
|
|
|
int32 printText8Var1 = 0;
|
|
|
|
int32 printText8Var2 = 0;
|
|
|
|
int32 printText8Var3 = 0;
|
|
|
|
int32 TEXT_CurrentLetterX = 0;
|
|
|
|
int32 printText8Var5 = 0;
|
|
|
|
int32 printText8Var6 = 0;
|
|
|
|
int32 TEXT_CurrentLetterY = 0;
|
|
|
|
char *printText8Var8 = nullptr;
|
|
|
|
int32 printText10Var1 = 0;
|
|
|
|
int32 addLineBreakX = 0;
|
2020-10-24 17:34:25 +02:00
|
|
|
int16 pt8s4[96] {0};
|
2020-10-14 15:16:30 +02:00
|
|
|
int32 printText8PrepareBufferVar2 = 0;
|
|
|
|
// ---
|
2020-10-27 00:19:28 +01:00
|
|
|
|
|
|
|
/** Current dialogue text pointer */
|
|
|
|
char *currDialTextPtr = nullptr;
|
|
|
|
/** Current dialogue text size */
|
|
|
|
int32 currDialTextSize = 0;
|
2020-10-14 15:16:30 +02:00
|
|
|
public:
|
|
|
|
Text(TwinEEngine *engine) : _engine(engine) {}
|
|
|
|
|
|
|
|
/** Current text bank */
|
2020-10-20 21:21:48 +02:00
|
|
|
int32 currentTextBank = -1;
|
2020-10-14 15:16:30 +02:00
|
|
|
|
|
|
|
/** Dialogue text size */
|
|
|
|
int32 dialTextSize = 0;
|
|
|
|
/** Pixel size between dialogue text */
|
|
|
|
int32 dialSpaceBetween = 0;
|
|
|
|
/** Pixel size of the space character */
|
|
|
|
int32 dialCharSpace = 0;
|
|
|
|
/** Dialogue text color */
|
|
|
|
int32 dialTextColor = 0;
|
|
|
|
|
|
|
|
/** Dialogue text start color for cross coloring dialogues */
|
|
|
|
int32 dialTextStartColor = 0;
|
|
|
|
/** Dialogue text stop color for cross coloring dialogues */
|
|
|
|
int32 dialTextStopColor = 0;
|
|
|
|
/** Dialogue text step size for cross coloring dialogues */
|
|
|
|
int32 dialTextStepSize = 0;
|
|
|
|
/** Dialogue text buffer size for cross coloring dialogues */
|
|
|
|
int32 dialTextBufferSize = 0;
|
|
|
|
|
|
|
|
int32 dialTextBoxLeft = 0; // dialogueBoxLeft
|
|
|
|
int32 dialTextBoxTop = 0; // dialogueBoxTop
|
|
|
|
int32 dialTextBoxRight = 0; // dialogueBoxRight
|
|
|
|
int32 dialTextBoxBottom = 0; // dialogueBoxBottom
|
|
|
|
|
|
|
|
int32 dialTextBoxParam1 = 0; // dialogueBoxParam1
|
|
|
|
int32 dialTextBoxParam2 = 0; // dialogueBoxParam2
|
|
|
|
|
|
|
|
// TODO: refactor all this variables and related functions
|
|
|
|
int32 printTextVar13 = 0;
|
|
|
|
int32 newGameVar4 = 0;
|
|
|
|
int32 newGameVar5 = 0;
|
2020-10-24 12:32:00 +02:00
|
|
|
bool hasHiddenVox = false; // printTextVar5
|
2020-10-14 15:16:30 +02:00
|
|
|
int32 voxHiddenIndex = 0;
|
|
|
|
// ---
|
|
|
|
|
|
|
|
int32 currDialTextEntry = 0; // ordered entry
|
|
|
|
int32 nextDialTextEntry = 0; // ordered entry
|
|
|
|
Common::String currentVoxBankFile;
|
|
|
|
|
2020-10-20 21:21:48 +02:00
|
|
|
int32 showDialogueBubble = 1;
|
2020-10-14 15:16:30 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize dialogue
|
|
|
|
* @param bankIdx Text bank index
|
|
|
|
*/
|
|
|
|
void initTextBank(int32 bankIdx);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display a certain dialogue text in the screen
|
|
|
|
* @param x X coordinate in screen
|
|
|
|
* @param y Y coordinate in screen
|
|
|
|
* @param dialogue ascii text to display
|
|
|
|
*/
|
|
|
|
void drawText(int32 x, int32 y, const char *dialogue);
|
|
|
|
|
2020-10-27 17:59:47 +01:00
|
|
|
bool drawTextFullscreen(int32 index);
|
2020-10-14 15:16:30 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets dialogue text width size
|
|
|
|
* @param dialogue ascii text to display
|
|
|
|
*/
|
|
|
|
int32 getTextSize(const char *dialogue);
|
|
|
|
|
|
|
|
void initDialogueBox();
|
|
|
|
void initInventoryDialogueBox();
|
|
|
|
|
|
|
|
void initText(int32 index);
|
|
|
|
int printText10();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set font type parameters
|
|
|
|
* @param spaceBetween number in pixels of space between characters
|
|
|
|
* @param charSpace number in pixels of the character space
|
|
|
|
*/
|
|
|
|
void setFontParameters(int32 spaceBetween, int32 charSpace);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the font cross color
|
|
|
|
* @param color color number to choose
|
|
|
|
*/
|
|
|
|
void setFontCrossColor(int32 color);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the font color
|
|
|
|
* @param color color number to choose
|
|
|
|
*/
|
|
|
|
void setFontColor(int32 color);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set font color parameters to precess cross color display
|
|
|
|
* @param stopColor color number to stop
|
|
|
|
* @param startColor color number to start
|
|
|
|
* @param stepSize step size to change between those colors
|
|
|
|
*/
|
|
|
|
void setTextCrossColor(int32 stopColor, int32 startColor, int32 stepSize);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get dialogue text into text buffer
|
|
|
|
* @param index dialogue index
|
|
|
|
*/
|
|
|
|
bool getText(int32 index);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets menu dialogue text
|
|
|
|
* @param index text index to display
|
|
|
|
* @param text dialogue text buffer to display
|
|
|
|
* @param textSize The size of the text buffer
|
|
|
|
*/
|
2020-10-27 00:00:47 +01:00
|
|
|
bool getMenuText(int32 index, char *text, uint32 textSize);
|
2020-10-14 15:16:30 +02:00
|
|
|
|
|
|
|
void textClipFull();
|
|
|
|
void textClipSmall();
|
|
|
|
|
|
|
|
void drawAskQuestion(int32 index);
|
|
|
|
|
2020-10-22 13:21:32 +02:00
|
|
|
bool playVox(int32 index);
|
|
|
|
bool playVoxSimple(int32 index);
|
|
|
|
bool stopVox(int32 index);
|
|
|
|
bool initVoxToPlay(int32 index);
|
2020-10-14 15:16:30 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace TwinE
|
2020-10-14 14:20:38 +02:00
|
|
|
|
|
|
|
#endif
|