mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-02 06:41:51 +00:00
EFH: Handle strings as Common::String references
This commit is contained in:
parent
6e7f0157fc
commit
72675018fb
@ -2557,13 +2557,14 @@ void EfhEngine::writeTechAndMapFiles() {
|
||||
// This function is therefore not useful and is not implemented.
|
||||
}
|
||||
|
||||
uint16 EfhEngine::getStringWidth(const char *buffer) {
|
||||
uint16 EfhEngine::getStringWidth(const Common::String &str) const {
|
||||
const char *buffer = str.c_str();
|
||||
debugC(6, kDebugEngine, "getStringWidth %s", buffer);
|
||||
|
||||
uint16 retVal = 0;
|
||||
|
||||
for (;;) {
|
||||
uint8 curChar = (uint8) *buffer++;
|
||||
byte curChar = (byte) *buffer++;
|
||||
if (curChar == 0) {
|
||||
--buffer;
|
||||
break;
|
||||
|
@ -311,7 +311,7 @@ private:
|
||||
void copyCurrentPlaceToBuffer(int16 id);
|
||||
uint8 getMapTileInfo(int16 mapPosX, int16 mapPosY);
|
||||
void writeTechAndMapFiles();
|
||||
uint16 getStringWidth(const char *buffer);
|
||||
uint16 getStringWidth(const Common::String &str) const;
|
||||
void setTextPos(int16 textPosX, int16 textPosY);
|
||||
void drawGameScreenAndTempText(bool flag);
|
||||
void drawMap(bool largeMapFl, int16 mapPosX, int16 mapPosY, int16 mapSize, bool drawHeroFl, bool drawMonstersFl);
|
||||
@ -327,10 +327,10 @@ private:
|
||||
bool giveItemTo(int16 charId, int16 objectId, int16 fromCharId);
|
||||
int16 chooseCharacterToReplace();
|
||||
int16 handleCharacterJoining();
|
||||
void drawText(uint8 *impPtr, int16 posX, int16 posY, int16 maxX, int16 maxY, bool flag);
|
||||
void drawText(uint8 *srcPtr, int16 posX, int16 posY, int16 maxX, int16 maxY, bool flag);
|
||||
void displayMiddleLeftTempText(uint8 *impArray, bool flag);
|
||||
void transitionMap(int16 centerX, int16 centerY);
|
||||
void setSpecialTechZone(int16 unkId, int16 arg1, int16 arg2);
|
||||
void setSpecialTechZone(int16 unkId, int16 centerX, int16 centerY);
|
||||
int16 findMapSpecialTileIndex(int16 posX, int16 posY);
|
||||
bool isPosOutOfMap(int16 mapPosX, int16 mapPosY);
|
||||
void goSouth();
|
||||
@ -443,9 +443,9 @@ private:
|
||||
void drawColoredRect(int16 minX, int16 minY, int16 maxX, int16 maxY, int16 color);
|
||||
void clearScreen(int16 color);
|
||||
void displayRawDataAtPos(uint8 *imagePtr, int16 posX, int16 posY);
|
||||
void drawString(const char *str, int16 startX, int16 startY, uint16 textColor);
|
||||
void displayCenteredString(Common::String str, int16 minX, int16 maxX, int16 posY);
|
||||
void displayMenuAnswerString(const char *str, int16 minX, int16 maxX, int16 posY);
|
||||
void drawString(const Common::String &str, int16 startX, int16 startY, uint16 textColor);
|
||||
void displayCenteredString(const Common::String &str, int16 minX, int16 maxX, int16 posY);
|
||||
void displayMenuAnswerString(const Common::String &str, int16 minX, int16 maxX, int16 posY);
|
||||
void drawMapWindow();
|
||||
void displayGameScreen();
|
||||
void drawUpperLeftBorders();
|
||||
@ -455,7 +455,7 @@ private:
|
||||
void setTextColorWhite();
|
||||
void setTextColorRed();
|
||||
void setTextColorGrey();
|
||||
void displayStringAtTextPos(Common::String message);
|
||||
void displayStringAtTextPos(const Common::String &message);
|
||||
void clearBottomTextZone(int16 color);
|
||||
void clearBottomTextZone_2(int16 color);
|
||||
void setNextCharacterPos();
|
||||
@ -464,7 +464,7 @@ private:
|
||||
void displayColoredMenuBox(int16 minX, int16 minY, int16 maxX, int16 maxY, int16 color);
|
||||
|
||||
// Menu
|
||||
int16 displayBoxWithText(Common::String str, int16 menuType, int16 displayOption, bool displayTeamWindowFl);
|
||||
int16 displayBoxWithText(const Common::String &str, int16 menuType, int16 displayOption, bool displayTeamWindowFl);
|
||||
bool handleDeathMenu();
|
||||
void displayCombatMenu(int16 charId);
|
||||
void displayMenuItemString(int16 menuBoxId, int16 thisBoxId, int16 minX, int16 maxX, int16 minY, const char *str);
|
||||
@ -475,7 +475,7 @@ private:
|
||||
void displayStatusMenuActions(int16 menuId, int16 curMenuLine, int16 npcId);
|
||||
void prepareStatusMenu(int16 windowId, int16 menuId, int16 curMenuLine, int16 charId, bool refreshFl);
|
||||
void displayWindowAndStatusMenu(int16 charId, int16 windowId, int16 menuId, int16 curMenuLine);
|
||||
int16 displayStringInSmallWindowWithBorder(Common::String str, bool delayFl, int16 charId, int16 windowId, int16 menuId, int16 curMenuLine);
|
||||
int16 displayStringInSmallWindowWithBorder(const Common::String &str, bool delayFl, int16 charId, int16 windowId, int16 menuId, int16 curMenuLine);
|
||||
int16 handleStatusMenu(int16 gameMode, int16 charId);
|
||||
void unequipItem(int16 charId, int16 objectId, int16 windowId, int16 menuId, int16 curMenuLine);
|
||||
void tryToggleEquipped(int16 charId, int16 objectId, int16 windowId, int16 menuId, int16 curMenuLine);
|
||||
|
@ -208,9 +208,9 @@ void EfhEngine::displayRawDataAtPos(uint8 *imagePtr, int16 posX, int16 posY) {
|
||||
displayBufferBmAtPos(&_imageDataPtr, posX, posY);
|
||||
}
|
||||
|
||||
void EfhEngine::drawString(const char *str, int16 startX, int16 startY, uint16 textColor) {
|
||||
debugC(1, kDebugGraphics, "drawString %s %d %d %d", str, startX, startY, textColor);
|
||||
const uint8 *curPtr = (const uint8 *)str;
|
||||
void EfhEngine::drawString(const Common::String &str, int16 startX, int16 startY, uint16 textColor) {
|
||||
debugC(1, kDebugGraphics, "drawString %s %d %d %d", str.c_str(), startX, startY, textColor);
|
||||
const uint8 *curPtr = (const uint8 *)str.c_str();
|
||||
uint16 lineHeight = _fontDescr._charHeight + _fontDescr._extraVerticalSpace;
|
||||
int16 minX = startX;
|
||||
|
||||
@ -244,15 +244,15 @@ void EfhEngine::drawString(const char *str, int16 startX, int16 startY, uint16 t
|
||||
}
|
||||
}
|
||||
|
||||
void EfhEngine::displayCenteredString(Common::String str, int16 minX, int16 maxX, int16 posY) {
|
||||
void EfhEngine::displayCenteredString(const Common::String &str, int16 minX, int16 maxX, int16 posY) {
|
||||
debugC(1, kDebugGraphics, "displayCenteredString %s %d-%d %d", str.c_str(), minX, maxX, posY);
|
||||
uint16 length = getStringWidth(str.c_str());
|
||||
uint16 length = getStringWidth(str);
|
||||
int16 startCenteredDisplayX = minX + (maxX - minX - length) / 2;
|
||||
drawString(str.c_str(), startCenteredDisplayX, posY, _textColor);
|
||||
drawString(str, startCenteredDisplayX, posY, _textColor);
|
||||
}
|
||||
|
||||
void EfhEngine::displayMenuAnswerString(const char *str, int16 minX, int16 maxX, int16 posY) {
|
||||
debugC(1, kDebugGraphics, "displayMenuAnswerString %s %d-%d %d", str, minX, maxX, posY);
|
||||
void EfhEngine::displayMenuAnswerString(const Common::String &str, int16 minX, int16 maxX, int16 posY) {
|
||||
debugC(1, kDebugGraphics, "displayMenuAnswerString %s %d-%d %d", str.c_str(), minX, maxX, posY);
|
||||
displayCenteredString(str, minX, maxX, posY);
|
||||
displayFctFullScreen();
|
||||
displayCenteredString(str, minX, maxX, posY);
|
||||
@ -345,11 +345,11 @@ void EfhEngine::setTextColorGrey() {
|
||||
_textColor = 0x8;
|
||||
}
|
||||
|
||||
void EfhEngine::displayStringAtTextPos(Common::String message) {
|
||||
void EfhEngine::displayStringAtTextPos(const Common::String &message) {
|
||||
debugC(1, kDebugGraphics, "displayStringAtTextPos %s", message.c_str());
|
||||
|
||||
drawString(message.c_str(), _textPosX, _textPosY, _textColor);
|
||||
_textPosX += getStringWidth(message.c_str()) + 1;
|
||||
drawString(message, _textPosX, _textPosY, _textColor);
|
||||
_textPosX += getStringWidth(message) + 1;
|
||||
setNextCharacterPos();
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
namespace Efh {
|
||||
|
||||
int16 EfhEngine::displayBoxWithText(Common::String str, int16 menuType, int16 displayOption, bool displayTeamWindowFl) {
|
||||
int16 EfhEngine::displayBoxWithText(const Common::String &str, int16 menuType, int16 displayOption, bool displayTeamWindowFl) {
|
||||
debugC(3, kDebugEngine, "displayBoxWithText %s %d %d %s", str.c_str(), menuType, displayOption, displayTeamWindowFl ? "True" : "False");
|
||||
|
||||
int16 retVal = 0xFF;
|
||||
@ -481,7 +481,7 @@ void EfhEngine::displayWindowAndStatusMenu(int16 charId, int16 windowId, int16 m
|
||||
}
|
||||
}
|
||||
|
||||
int16 EfhEngine::displayStringInSmallWindowWithBorder(Common::String str, bool delayFl, int16 charId, int16 windowId, int16 menuId, int16 curMenuLine) {
|
||||
int16 EfhEngine::displayStringInSmallWindowWithBorder(const Common::String &str, bool delayFl, int16 charId, int16 windowId, int16 menuId, int16 curMenuLine) {
|
||||
debugC(3, kDebugEngine, "displayStringInSmallWindowWithBorder %s %s %d %d %d %d", str.c_str(), delayFl ? "True" : "False", charId, windowId, menuId, curMenuLine);
|
||||
|
||||
int16 retVal = 0;
|
||||
|
@ -90,7 +90,7 @@ int16 EfhEngine::script_parse(Common::String stringBuffer, int16 posX, int16 pos
|
||||
|
||||
nextWord[curWordPos] = 0;
|
||||
int16 widthNextWord = getStringWidth(nextWord);
|
||||
int16 widthCurrentLine = spaceWidth + getStringWidth(curLine.c_str());
|
||||
int16 widthCurrentLine = spaceWidth + getStringWidth(curLine);
|
||||
|
||||
if (widthCurrentLine + widthNextWord > width || curChar == 0x7C) { // '|'
|
||||
if (curLineNb >= numbLines) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user