modify for interface line height and wrap

This commit is contained in:
sonil 2022-11-11 18:53:30 +08:00
parent 85e534f2d7
commit 99cc193e57
7 changed files with 199 additions and 152 deletions

View File

@ -2390,7 +2390,9 @@ static void characterEditorDrawPcStats()
fontDrawText(gCharacterEditorWindowBuffer + 640 * y + 32, stringBuffer, 640, 640, color);
// EXPERIENCE
y += fontGetLineHeight() + 1;
//y += fontGetLineHeight() + 1;
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
y += 10 + 1;
if (characterEditorSelectedItem != 8) {
color = _colorTable[992];
} else {
@ -2404,7 +2406,9 @@ static void characterEditorDrawPcStats()
fontDrawText(gCharacterEditorWindowBuffer + 640 * y + 32, stringBuffer, 640, 640, color);
// EXP NEEDED TO NEXT LEVEL
y += fontGetLineHeight() + 1;
//y += fontGetLineHeight() + 1;
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
y += 10 + 1;
if (characterEditorSelectedItem != 9) {
color = _colorTable[992];
} else {
@ -2656,8 +2660,12 @@ static void characterEditorDrawDerivedStats()
snprintf(t, sizeof(t), "%d/%d", currHp, maxHp);
fontDrawText(gCharacterEditorWindowBuffer + 640 * y + 263, t, 640, 640, color);
// Poisoned
y += fontGetLineHeight() + 3;
//y += fontGetLineHeight() + 3;
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
y += 13;
if (characterEditorSelectedItem == EDITOR_POISONED) {
color = critterGetPoison(gDude) != 0 ? _colorTable[32747] : _colorTable[15845];
@ -2670,7 +2678,9 @@ static void characterEditorDrawDerivedStats()
fontDrawText(gCharacterEditorWindowBuffer + 640 * y + 194, t, 640, 640, color);
// Radiated
y += fontGetLineHeight() + 3;
//y += fontGetLineHeight() + 3;
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
y += 13;
if (characterEditorSelectedItem == EDITOR_RADIATED) {
color = critterGetRadiation(gDude) != 0 ? _colorTable[32747] : _colorTable[15845];
@ -2683,7 +2693,9 @@ static void characterEditorDrawDerivedStats()
fontDrawText(gCharacterEditorWindowBuffer + 640 * y + 194, t, 640, 640, color);
// Eye Damage
y += fontGetLineHeight() + 3;
//y += fontGetLineHeight() + 3;
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
y += 13;
if (characterEditorSelectedItem == EDITOR_EYE_DAMAGE) {
color = (conditions & DAM_BLIND) ? _colorTable[32747] : _colorTable[15845];
@ -2696,7 +2708,9 @@ static void characterEditorDrawDerivedStats()
fontDrawText(gCharacterEditorWindowBuffer + 640 * y + 194, t, 640, 640, color);
// Crippled Right Arm
y += fontGetLineHeight() + 3;
//y += fontGetLineHeight() + 3;
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
y += 13;
if (characterEditorSelectedItem == EDITOR_CRIPPLED_RIGHT_ARM) {
color = (conditions & DAM_CRIP_ARM_RIGHT) ? _colorTable[32747] : _colorTable[15845];
@ -2709,7 +2723,9 @@ static void characterEditorDrawDerivedStats()
fontDrawText(gCharacterEditorWindowBuffer + 640 * y + 194, t, 640, 640, color);
// Crippled Left Arm
y += fontGetLineHeight() + 3;
//y += fontGetLineHeight() + 3;
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
y += 13;
if (characterEditorSelectedItem == EDITOR_CRIPPLED_LEFT_ARM) {
color = (conditions & DAM_CRIP_ARM_LEFT) ? _colorTable[32747] : _colorTable[15845];
@ -2722,7 +2738,9 @@ static void characterEditorDrawDerivedStats()
fontDrawText(gCharacterEditorWindowBuffer + 640 * y + 194, t, 640, 640, color);
// Crippled Right Leg
y += fontGetLineHeight() + 3;
//y += fontGetLineHeight() + 3;
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
y += 13;
if (characterEditorSelectedItem == EDITOR_CRIPPLED_RIGHT_LEG) {
color = (conditions & DAM_CRIP_LEG_RIGHT) ? _colorTable[32747] : _colorTable[15845];
@ -2735,7 +2753,9 @@ static void characterEditorDrawDerivedStats()
fontDrawText(gCharacterEditorWindowBuffer + 640 * y + 194, t, 640, 640, color);
// Crippled Left Leg
y += fontGetLineHeight() + 3;
//y += fontGetLineHeight() + 3;
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
y += 13;
if (characterEditorSelectedItem == EDITOR_CRIPPLED_LEFT_LEG) {
color = (conditions & DAM_CRIP_LEG_LEFT) ? _colorTable[32747] : _colorTable[15845];
@ -2766,7 +2786,9 @@ static void characterEditorDrawDerivedStats()
fontDrawText(gCharacterEditorWindowBuffer + 640 * y + 288, t, 640, 640, color);
// Action Points
y += fontGetLineHeight() + 3;
//y += fontGetLineHeight() + 3;
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
y += 13;
if (characterEditorSelectedItem == EDITOR_FIRST_DERIVED_STAT + EDITOR_DERIVED_STAT_ACTION_POINTS) {
color = _colorTable[32747];
@ -2782,7 +2804,9 @@ static void characterEditorDrawDerivedStats()
fontDrawText(gCharacterEditorWindowBuffer + 640 * y + 288, t, 640, 640, color);
// Carry Weight
y += fontGetLineHeight() + 3;
//y += fontGetLineHeight() + 3;
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
y += 13;
if (characterEditorSelectedItem == EDITOR_FIRST_DERIVED_STAT + EDITOR_DERIVED_STAT_CARRY_WEIGHT) {
color = _colorTable[32747];
@ -2798,7 +2822,9 @@ static void characterEditorDrawDerivedStats()
fontDrawText(gCharacterEditorWindowBuffer + 640 * y + 288, t, 640, 640, critterIsEncumbered(gDude) ? _colorTable[31744] : color);
// Melee Damage
y += fontGetLineHeight() + 3;
//y += fontGetLineHeight() + 3;
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
y += 13;
if (characterEditorSelectedItem == EDITOR_FIRST_DERIVED_STAT + EDITOR_DERIVED_STAT_MELEE_DAMAGE) {
color = _colorTable[32747];
@ -2820,7 +2846,9 @@ static void characterEditorDrawDerivedStats()
fontDrawText(gCharacterEditorWindowBuffer + 640 * y + 288, t, 640, 640, color);
// Damage Resistance
y += fontGetLineHeight() + 3;
//y += fontGetLineHeight() + 3;
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
y += 13;
if (characterEditorSelectedItem == EDITOR_FIRST_DERIVED_STAT + EDITOR_DERIVED_STAT_DAMAGE_RESISTANCE) {
color = _colorTable[32747];
@ -2836,7 +2864,9 @@ static void characterEditorDrawDerivedStats()
fontDrawText(gCharacterEditorWindowBuffer + 640 * y + 288, t, 640, 640, color);
// Poison Resistance
y += fontGetLineHeight() + 3;
//y += fontGetLineHeight() + 3;
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
y += 13;
if (characterEditorSelectedItem == EDITOR_FIRST_DERIVED_STAT + EDITOR_DERIVED_STAT_POISON_RESISTANCE) {
color = _colorTable[32747];
@ -2852,7 +2882,9 @@ static void characterEditorDrawDerivedStats()
fontDrawText(gCharacterEditorWindowBuffer + 640 * y + 288, t, 640, 640, color);
// Radiation Resistance
y += fontGetLineHeight() + 3;
//y += fontGetLineHeight() + 3;
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
y += 13;
if (characterEditorSelectedItem == EDITOR_FIRST_DERIVED_STAT + EDITOR_DERIVED_STAT_RADIATION_RESISTANCE) {
color = _colorTable[32747];
@ -2868,7 +2900,9 @@ static void characterEditorDrawDerivedStats()
fontDrawText(gCharacterEditorWindowBuffer + 640 * y + 288, t, 640, 640, color);
// Sequence
y += fontGetLineHeight() + 3;
//y += fontGetLineHeight() + 3;
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
y += 13;
if (characterEditorSelectedItem == EDITOR_FIRST_DERIVED_STAT + EDITOR_DERIVED_STAT_SEQUENCE) {
color = _colorTable[32747];
@ -2884,7 +2918,9 @@ static void characterEditorDrawDerivedStats()
fontDrawText(gCharacterEditorWindowBuffer + 640 * y + 288, t, 640, 640, color);
// Healing Rate
y += fontGetLineHeight() + 3;
//y += fontGetLineHeight() + 3;
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
y += 13;
if (characterEditorSelectedItem == EDITOR_FIRST_DERIVED_STAT + EDITOR_DERIVED_STAT_HEALING_RATE) {
color = _colorTable[32747];
@ -2900,7 +2936,9 @@ static void characterEditorDrawDerivedStats()
fontDrawText(gCharacterEditorWindowBuffer + 640 * y + 288, t, 640, 640, color);
// Critical Chance
y += fontGetLineHeight() + 3;
//y += fontGetLineHeight() + 3;
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
y += 13;
if (characterEditorSelectedItem == EDITOR_FIRST_DERIVED_STAT + EDITOR_DERIVED_STAT_CRITICAL_CHANCE) {
color = _colorTable[32747];
@ -2994,11 +3032,15 @@ static void characterEditorDrawSkills(int a1)
fontDrawText(gCharacterEditorWindowBuffer + 640 * y + 573, valueString, 640, 640, color);
y += fontGetLineHeight() + 1;
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
//y += fontGetLineHeight() + 1;
y += 10 + 1;
}
if (!gCharacterEditorIsCreationMode) {
y = gCharacterEditorCurrentSkill * (fontGetLineHeight() + 1);
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
//y = gCharacterEditorCurrentSkill * (fontGetLineHeight() + 1);
y = gCharacterEditorCurrentSkill * (10 + 1);
gCharacterEditorSkillValueAdjustmentSliderY = y + 27;
blitBufferToBufferTrans(
@ -5132,7 +5174,9 @@ static void characterEditorHandleInfoButtonPressed(int eventCode)
double mouseY = gCharacterEditorMouseY;
double fontLineHeight = fontGetLineHeight();
double y = 353.0;
double step = fontGetLineHeight() + 3 + 0.56;
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
//double step = fontGetLineHeight() + 3 + 0.56;
double step = 10 + 3 + 0.56;
int index;
for (index = 0; index < 8; index++) {
if (mouseY >= y - 4.0 && mouseY <= y + fontLineHeight) {
@ -5397,7 +5441,9 @@ static void characterEditorDrawOptionalTraits()
traitsSetSelected(gCharacterEditorTempTraits[0], gCharacterEditorTempTraits[1]);
step = fontGetLineHeight() + 3 + 0.56;
//step = fontGetLineHeight() + 3 + 0.56;
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
step = 10 + 3 + 0.56;
y = 353;
for (i = 0; i < 8; i++) {
if (i == v0) {
@ -6300,8 +6346,8 @@ static int perkDialogDrawPerks()
qsort(gPerkDialogOptionList, count, sizeof(*gPerkDialogOptionList), perkDialogOptionCompare);
int v16 = count - gPerkDialogTopLine;
if (v16 > 11) {
v16 = 11;
if (v16 > 11 * 12 / (fontGetLineHeight() + 2)) {
v16 = 11 * 12 / (fontGetLineHeight() + 2);
}
v16 += gPerkDialogTopLine;

View File

@ -621,7 +621,10 @@ static bool characterSelectorWindowRenderStats()
fontGetCharacterWidth(0x20);
int vh = fontGetLineHeight();
// Adapt to other languages, because the pixels here are fixed, so the calculation of LineHeight brings trouble - replaces it with fixed pixel values
//int vh = fontGetLineHeight();
int vh = 11;
int y = 40;
// NAME

View File

@ -456,8 +456,8 @@ int showDialogBox(const char* title, const char** body, int bodyLength, int x, i
backgroundFrmImage.getWidth(),
titleColor);
}
nextY += fontGetLineHeight();
}
//nextY += fontGetLineHeight();
nextY += 10; }
for (int index = 0; index < bodyLength && nextY < maxY; index++) {
int width = fontGetStringWidth(body[index]);
@ -477,7 +477,8 @@ int showDialogBox(const char* title, const char** body, int bodyLength, int x, i
backgroundFrmImage.getWidth(),
bodyColor);
}
nextY += fontGetLineHeight();
//nextY += fontGetLineHeight();
nextY += 10;
} else {
short beginnings[WORD_WRAP_MAX_COUNT];
short count;
@ -515,8 +516,8 @@ int showDialogBox(const char* title, const char** body, int bodyLength, int x, i
backgroundFrmImage.getWidth(),
bodyColor);
}
nextY += fontGetLineHeight();
}
//nextY += fontGetLineHeight();
nextY += 10; }
}
}

View File

@ -40,6 +40,7 @@
#include "text_object.h"
#include "tile.h"
#include "window_manager.h"
#include "word_wrap.h"
namespace fallout {
@ -589,7 +590,7 @@ static void gameDialogTicker();
static void _gdialog_scroll_subwin(int a1, int a2, unsigned char* a3, unsigned char* a4, unsigned char* a5, int a6, int a7);
static int _text_num_lines(const char* a1, int a2);
static int text_to_rect_wrapped(unsigned char* buffer, Rect* rect, char* string, int* a4, int height, int pitch, int color);
static int gameDialogDrawText(unsigned char* buffer, Rect* rect, char* string, int* a4, int height, int pitch, int color, int a7);
static int gameDialogDrawText(unsigned char* buffer, Rect* rect, char* string, int* a4, int height, int pitch, int color);
static int _gdialog_barter_create_win();
static void _gdialog_barter_destroy_win();
static void _gdialog_barter_cleanup_tables();
@ -3040,117 +3041,64 @@ int _text_num_lines(const char* a1, int a2)
// 0x447F80
static int text_to_rect_wrapped(unsigned char* buffer, Rect* rect, char* string, int* a4, int height, int pitch, int color)
{
return gameDialogDrawText(buffer, rect, string, a4, height, pitch, color, 1);
return gameDialogDrawText(buffer, rect, string, a4, height, pitch, color);
}
// display_msg
// 0x447FA0
int gameDialogDrawText(unsigned char* buffer, Rect* rect, char* string, int* a4, int height, int pitch, int color, int a7)
int gameDialogDrawText(unsigned char* buffer, Rect* rect, char* string, int* offset, int height, int pitch, int color)
{
short beginnings[WORD_WRAP_MAX_COUNT] = {
-1,
};
short count = -1;
int maxWidth = rect->right - rect->left;
char* start;
if (a4 != NULL) {
start = string + *a4;
if (offset != NULL) {
start = string + *offset;
} else {
start = string;
}
int maxWidth = rect->right - rect->left;
char* end = NULL;
while (start != NULL && *start != '\0') {
if (fontGetStringWidth(start) > maxWidth) {
end = start + 1;
while (*end != '\0' && *end != ' ') {
end++;
}
if (*end != '\0') {
char* lookahead = end + 1;
while (lookahead != NULL) {
while (*lookahead != '\0' && *lookahead != ' ') {
lookahead++;
}
if (*lookahead == '\0') {
lookahead = NULL;
} else {
*lookahead = '\0';
if (fontGetStringWidth(start) >= maxWidth) {
*lookahead = ' ';
lookahead = NULL;
} else {
end = lookahead;
*lookahead = ' ';
lookahead++;
}
}
}
if (*end == ' ') {
*end = '\0';
}
} else {
if (rect->bottom - fontGetLineHeight() < rect->top) {
return rect->top;
}
if (a7 != 1 || start == string) {
fontDrawText(buffer + pitch * rect->top + 10, start, maxWidth, pitch, color);
} else {
fontDrawText(buffer + pitch * rect->top, start, maxWidth, pitch, color);
}
if (a4 != NULL) {
*a4 += static_cast<int>(strlen(start)) + 1;
}
rect->top += height;
return rect->top;
if (wordWrap(start, maxWidth, beginnings, &count) != 0) {
// FIXME: Leaks handle.
return rect->top;
}
int tmp = 0;
for (int index = 0; index < count - 1; index++) {
if (rect->top + height > rect->bottom) {
if (offset != NULL) {
*offset = tmp;
}
return rect->top;
}
if (fontGetStringWidth(start) > maxWidth) {
debugPrint("\nError: display_msg: word too long!");
break;
}
char* beginning = start + beginnings[index];
char* ending = start + beginnings[index + 1];
if (a7 != 0) {
if (rect->bottom - fontGetLineHeight() < rect->top) {
if (end != NULL && *end == '\0') {
*end = ' ';
}
return rect->top;
}
unsigned char* dest;
if (a7 != 1 || start == string) {
dest = buffer + 10;
} else {
dest = buffer;
}
fontDrawText(dest + pitch * rect->top, start, maxWidth, pitch, color);
}
if (a4 != NULL && end != NULL) {
*a4 += static_cast<int>(strlen(start)) + 1;
}
rect->top += height;
if (end != NULL) {
start = end + 1;
if (*end == '\0') {
*end = ' ';
}
end = NULL;
char tmpchar = ending[0];
ending[0] = '\0';
if (beginning == string) {
fontDrawText(buffer + pitch * rect->top + 10, beginning, maxWidth, pitch, color);
} else {
start = NULL;
fontDrawText(buffer + pitch * rect->top, beginning, maxWidth, pitch, color);
}
ending[0] = tmpchar;
tmp += ending - beginning;
if (offset != NULL) {
*offset += ending - beginning;
}
rect->top += height;
}
if (a4 != NULL) {
*a4 = 0;
if (offset != NULL) {
*offset = 0;
}
return rect->top;
}

View File

@ -2894,14 +2894,14 @@ static void inventoryRenderSummary()
bufferDrawLine(windowBuffer,
INVENTORY_WINDOW_WIDTH,
INVENTORY_SUMMARY_X,
3 * fontGetLineHeight() / 2 + INVENTORY_SUMMARY_Y,
3 * 10 / 2 + INVENTORY_SUMMARY_Y,
INVENTORY_SUMMARY_MAX_X,
3 * fontGetLineHeight() / 2 + INVENTORY_SUMMARY_Y,
3 * 10 / 2 + INVENTORY_SUMMARY_Y,
_colorTable[992]);
MessageListItem messageListItem;
int offset = INVENTORY_WINDOW_WIDTH * 2 * fontGetLineHeight() + INVENTORY_WINDOW_WIDTH * INVENTORY_SUMMARY_Y + INVENTORY_SUMMARY_X;
int offset = INVENTORY_WINDOW_WIDTH * 2 * 10 + INVENTORY_WINDOW_WIDTH * INVENTORY_SUMMARY_Y + INVENTORY_SUMMARY_X;
for (int stat = 0; stat < 7; stat++) {
messageListItem.num = stat;
if (messageListGetItem(&gInventoryMessageList, &messageListItem)) {
@ -2912,10 +2912,10 @@ static void inventoryRenderSummary()
snprintf(formattedText, sizeof(formattedText), "%d", value);
fontDrawText(windowBuffer + offset + 24, formattedText, 80, INVENTORY_WINDOW_WIDTH, _colorTable[992]);
offset += INVENTORY_WINDOW_WIDTH * fontGetLineHeight();
offset += INVENTORY_WINDOW_WIDTH * 10;
}
offset -= INVENTORY_WINDOW_WIDTH * 7 * fontGetLineHeight();
offset -= INVENTORY_WINDOW_WIDTH * 7 * 10;
for (int index = 0; index < 7; index += 1) {
messageListItem.num = 7 + index;
@ -2935,11 +2935,11 @@ static void inventoryRenderSummary()
fontDrawText(windowBuffer + offset + 104, formattedText, 80, INVENTORY_WINDOW_WIDTH, _colorTable[992]);
offset += INVENTORY_WINDOW_WIDTH * fontGetLineHeight();
offset += INVENTORY_WINDOW_WIDTH * 10;
}
bufferDrawLine(windowBuffer, INVENTORY_WINDOW_WIDTH, INVENTORY_SUMMARY_X, 18 * fontGetLineHeight() / 2 + 48, INVENTORY_SUMMARY_MAX_X, 18 * fontGetLineHeight() / 2 + 48, _colorTable[992]);
bufferDrawLine(windowBuffer, INVENTORY_WINDOW_WIDTH, INVENTORY_SUMMARY_X, 26 * fontGetLineHeight() / 2 + 48, INVENTORY_SUMMARY_MAX_X, 26 * fontGetLineHeight() / 2 + 48, _colorTable[992]);
bufferDrawLine(windowBuffer, INVENTORY_WINDOW_WIDTH, INVENTORY_SUMMARY_X, 18 * 10 / 2 + 48, INVENTORY_SUMMARY_MAX_X, 18 * 10 / 2 + 48, _colorTable[992]);
bufferDrawLine(windowBuffer, INVENTORY_WINDOW_WIDTH, INVENTORY_SUMMARY_X, 26 * 10 / 2 + 48, INVENTORY_SUMMARY_MAX_X, 26 * 10 / 2 + 48, _colorTable[992]);
Object* itemsInHands[2] = {
gInventoryLeftHandItem,
@ -2961,7 +2961,7 @@ static void inventoryRenderSummary()
HIT_MODE_KICK,
};
offset += INVENTORY_WINDOW_WIDTH * fontGetLineHeight();
offset += INVENTORY_WINDOW_WIDTH * 10;
for (int index = 0; index < 2; index += 1) {
Object* item = itemsInHands[index];
@ -2974,7 +2974,7 @@ static void inventoryRenderSummary()
fontDrawText(windowBuffer + offset, messageListItem.text, 120, INVENTORY_WINDOW_WIDTH, _colorTable[992]);
}
offset += INVENTORY_WINDOW_WIDTH * fontGetLineHeight();
offset += INVENTORY_WINDOW_WIDTH * 10;
// Unarmed dmg:
messageListItem.num = 24;
@ -3010,14 +3010,14 @@ static void inventoryRenderSummary()
fontDrawText(windowBuffer + offset, formattedText, 120, INVENTORY_WINDOW_WIDTH, _colorTable[992]);
offset += 3 * INVENTORY_WINDOW_WIDTH * fontGetLineHeight();
offset += 3 * INVENTORY_WINDOW_WIDTH * 10;
continue;
}
const char* itemName = itemGetName(item);
fontDrawText(windowBuffer + offset, itemName, 140, INVENTORY_WINDOW_WIDTH, _colorTable[992]);
offset += INVENTORY_WINDOW_WIDTH * fontGetLineHeight();
offset += INVENTORY_WINDOW_WIDTH * 10;
int itemType = itemGetType(item);
if (itemType != ITEM_TYPE_WEAPON) {
@ -3029,7 +3029,7 @@ static void inventoryRenderSummary()
}
}
offset += 3 * INVENTORY_WINDOW_WIDTH * fontGetLineHeight();
offset += 3 * INVENTORY_WINDOW_WIDTH * 10;
continue;
}
@ -3108,7 +3108,7 @@ static void inventoryRenderSummary()
fontDrawText(windowBuffer + offset, formattedText, 140, INVENTORY_WINDOW_WIDTH, _colorTable[992]);
}
offset += INVENTORY_WINDOW_WIDTH * fontGetLineHeight();
offset += INVENTORY_WINDOW_WIDTH * 10;
if (ammoGetCapacity(item) > 0) {
int ammoTypePid = weaponGetAmmoTypePid(item);
@ -3138,7 +3138,7 @@ static void inventoryRenderSummary()
fontDrawText(windowBuffer + offset, formattedText, 140, INVENTORY_WINDOW_WIDTH, _colorTable[992]);
}
offset += 2 * INVENTORY_WINDOW_WIDTH * fontGetLineHeight();
offset += 2 * INVENTORY_WINDOW_WIDTH * 10;
}
// Total wt:
@ -3637,7 +3637,7 @@ static void inventoryExamineItem(Object* critter, Object* item)
if (backgroundFrmImage.lock(backgroundFid)) {
blitBufferToBuffer(backgroundFrmImage.getData() + INVENTORY_WINDOW_WIDTH * INVENTORY_SUMMARY_Y + INVENTORY_SUMMARY_X,
152,
188,
200,
INVENTORY_WINDOW_WIDTH,
windowBuffer + INVENTORY_WINDOW_WIDTH * INVENTORY_SUMMARY_Y + INVENTORY_SUMMARY_X,
INVENTORY_WINDOW_WIDTH);

View File

@ -532,7 +532,8 @@ int lsgSaveGame(int mode)
int mouseY;
mouseGetPositionInWindow(gLoadSaveWindow, &mouseX, &mouseY);
_slot_cursor = (mouseY - 79) / (3 * fontGetLineHeight() + 4);
//_slot_cursor = (mouseY - 79) / (3 * fontGetLineHeight() + 4);
_slot_cursor = (mouseY - 79) / (3 * 10 + 4);
if (_slot_cursor < 0) {
_slot_cursor = 0;
}
@ -1037,7 +1038,8 @@ int lsgLoadGame(int mode)
int mouseY;
mouseGetPositionInWindow(gLoadSaveWindow, &mouseX, &mouseY);
int clickedSlot = (mouseY - 79) / (3 * fontGetLineHeight() + 4);
//int clickedSlot = (mouseY - 79) / (3 * fontGetLineHeight() + 4);
int clickedSlot = (mouseY - 79) / (3 * 10 + 4);
if (clickedSlot < 0) {
clickedSlot = 0;
} else if (clickedSlot > 9) {
@ -1935,7 +1937,8 @@ static void _ShowSlotList(int a1)
snprintf(_str, sizeof(_str), "[ %s %.2d: ]", text, index + 1);
fontDrawText(gLoadSaveWindowBuffer + LS_WINDOW_WIDTH * y + 55, _str, LS_WINDOW_WIDTH, LS_WINDOW_WIDTH, color);
y += fontGetLineHeight();
y += 10;
//fontGetLineHeight();
switch (_LSstatus[index]) {
case SLOT_STATE_OCCUPIED:
strcpy(_str, _LSData[index].description);
@ -1960,7 +1963,8 @@ static void _ShowSlotList(int a1)
}
fontDrawText(gLoadSaveWindowBuffer + LS_WINDOW_WIDTH * y + 55, _str, LS_WINDOW_WIDTH, LS_WINDOW_WIDTH, color);
y += 2 * fontGetLineHeight() + 4;
//y += 2 * fontGetLineHeight() + 4;
y += 2 * 10 + 4;
}
}
@ -1987,7 +1991,8 @@ static void _DrawInfoBox(int a1)
text = getmsg(&gLoadSaveMessageList, &gLoadSaveMessageListItem, 116 + ptr->field_68);
snprintf(_str, sizeof(_str), "%.2d %s %.4d %.4d", ptr->field_6A, text, ptr->field_6C, v21);
int v2 = fontGetLineHeight();
int v2 = 10;
//fontGetLineHeight();
fontDrawText(gLoadSaveWindowBuffer + LS_WINDOW_WIDTH * (256 + v2) + 397, _str, LS_WINDOW_WIDTH, LS_WINDOW_WIDTH, color);
const char* v22 = mapGetName(ptr->field_76, ptr->field_74);
@ -2196,7 +2201,8 @@ static int _get_input_str2(int win, int doneKeyCode, int cancelKeyCode, char* de
{
int cursorWidth = fontGetStringWidth("_") - 4;
int windowWidth = windowGetWidth(win);
int lineHeight = fontGetLineHeight();
int lineHeight = 10;
//fontGetLineHeight();
unsigned char* windowBuffer = windowGetBuffer(win);
if (maxLength > 255) {
maxLength = 255;

View File

@ -396,6 +396,10 @@ static int gPipboyPrevTab;
static FrmImage _pipboyFrmImages[PIPBOY_FRM_COUNT];
static int pipboyLineMax()
{
return PIPBOY_HOLODISK_LINES_MAX * 10 / fontGetLineHeight();
}
// 0x497004
int pipboyOpen(int intent)
{
@ -506,7 +510,8 @@ static int pipboyWindowInit(int intent)
_rest_time = 0;
gPipboyCurrentLine = 0;
gPipboyWindowButtonCount = 0;
gPipboyLinesCount = PIPBOY_WINDOW_CONTENT_VIEW_HEIGHT / fontGetLineHeight() - 1;
//gPipboyLinesCount = PIPBOY_WINDOW_CONTENT_VIEW_HEIGHT / fontGetLineHeight() - 1;
gPipboyLinesCount = PIPBOY_WINDOW_CONTENT_VIEW_HEIGHT / 10 - 1;
gPipboyWindowButtonStart = 0;
_hot_back_line = 0;
@ -808,6 +813,43 @@ static void pipboyDrawText(const char* text, int flags, int color)
left += 260 - length;
}
//fontDrawText(gPipboyWindowBuffer + PIPBOY_WINDOW_WIDTH * (gPipboyCurrentLine * fontGetLineHeight() + PIPBOY_WINDOW_CONTENT_VIEW_Y) + PIPBOY_WINDOW_CONTENT_VIEW_X + left, text, PIPBOY_WINDOW_WIDTH, PIPBOY_WINDOW_WIDTH, color);
fontDrawText(gPipboyWindowBuffer + PIPBOY_WINDOW_WIDTH * (gPipboyCurrentLine * 10 + PIPBOY_WINDOW_CONTENT_VIEW_Y) + PIPBOY_WINDOW_CONTENT_VIEW_X + left, text, PIPBOY_WINDOW_WIDTH, PIPBOY_WINDOW_WIDTH, color);
if ((flags & PIPBOY_TEXT_STYLE_STRIKE_THROUGH) != 0) {
//int top = gPipboyCurrentLine * fontGetLineHeight() + 49;
int top = gPipboyCurrentLine * 10 + 49;
bufferDrawLine(gPipboyWindowBuffer, PIPBOY_WINDOW_WIDTH, PIPBOY_WINDOW_CONTENT_VIEW_X + left, top, PIPBOY_WINDOW_CONTENT_VIEW_X + left + length, top, color);
}
if (gPipboyCurrentLine < gPipboyLinesCount) {
gPipboyCurrentLine += 1;
}
}
static void pipboyDrawTextLegacy(const char* text, int flags, int color)
{
if ((flags & PIPBOY_TEXT_STYLE_UNDERLINE) != 0) {
color |= FONT_UNDERLINE;
}
int left = 8;
if ((flags & PIPBOY_TEXT_NO_INDENT) != 0) {
left -= 7;
}
int length = fontGetStringWidth(text);
if ((flags & PIPBOY_TEXT_ALIGNMENT_CENTER) != 0) {
left = (350 - length) / 2;
} else if ((flags & PIPBOY_TEXT_ALIGNMENT_RIGHT_COLUMN) != 0) {
left += 175;
} else if ((flags & PIPBOY_TEXT_ALIGNMENT_LEFT_COLUMN_CENTER) != 0) {
left += 86 - length + 16;
} else if ((flags & PIPBOY_TEXT_ALIGNMENT_RIGHT_COLUMN_CENTER) != 0) {
left += 260 - length;
}
fontDrawText(gPipboyWindowBuffer + PIPBOY_WINDOW_WIDTH * (gPipboyCurrentLine * fontGetLineHeight() + PIPBOY_WINDOW_CONTENT_VIEW_Y) + PIPBOY_WINDOW_CONTENT_VIEW_X + left, text, PIPBOY_WINDOW_WIDTH, PIPBOY_WINDOW_WIDTH, color);
if ((flags & PIPBOY_TEXT_STYLE_STRIKE_THROUGH) != 0) {
@ -1274,7 +1316,7 @@ static void pipboyRenderHolodiskText()
}
linesCount += 1;
if (linesCount >= PIPBOY_HOLODISK_LINES_MAX) {
if (linesCount >= pipboyLineMax()) {
linesCount = 0;
gPipboyHolodiskLastPage += 1;
}
@ -1297,7 +1339,7 @@ static void pipboyRenderHolodiskText()
}
numberOfLines += 1;
if (numberOfLines >= PIPBOY_HOLODISK_LINES_MAX) {
if (numberOfLines >= pipboyLineMax()) {
page += 1;
if (page >= _view_page) {
break;
@ -1331,7 +1373,7 @@ static void pipboyRenderHolodiskText()
gPipboyCurrentLine = 3;
}
for (int line = 0; line < PIPBOY_HOLODISK_LINES_MAX; line += 1) {
for (int line = 0; line < pipboyLineMax(); line += 1) {
const char* text = getmsg(&gPipboyMessageList, &gPipboyMessageListItem, holodiskTextId);
if (strcmp(text, "**END-DISK**") == 0) {
break;
@ -1340,7 +1382,7 @@ static void pipboyRenderHolodiskText()
if (strcmp(text, "**END-PAR**") == 0) {
gPipboyCurrentLine += 1;
} else {
pipboyDrawText(text, PIPBOY_TEXT_NO_INDENT, _colorTable[992]);
pipboyDrawTextLegacy(text, PIPBOY_TEXT_NO_INDENT, _colorTable[992]);
}
holodiskTextId += 1;
@ -1896,7 +1938,8 @@ static void pipboyWindowCreateButtons(int start, int count, bool a3)
{
fontSetCurrent(101);
int height = fontGetLineHeight();
//int height = fontGetLineHeight();
int height = 10;
gPipboyWindowButtonStart = start;
gPipboyWindowButtonCount = count;