mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-22 01:39:57 +00:00
TWINE: fixed assert in drawPlayerName
This commit is contained in:
parent
71921f241c
commit
934a250cfd
@ -409,7 +409,7 @@ int32 Debug::debugProcessButton(int32 X, int32 Y) {
|
||||
|
||||
void Debug::debugPlasmaWindow(const char *text, int32 color) {
|
||||
int32 textSize;
|
||||
_engine->_menu->processPlasmaEffect(0, 5, SCREEN_WIDTH, color);
|
||||
_engine->_menu->processPlasmaEffect(0, 5, color);
|
||||
if (!(_engine->getRandomNumber() % 5)) {
|
||||
_engine->_menu->plasmaEffectPtr[_engine->getRandomNumber() % 320 * 10 + 6400] = 255;
|
||||
}
|
||||
|
@ -228,10 +228,6 @@ static const int16 VolumeMenuSettings[] = {
|
||||
};
|
||||
} // namespace _priv
|
||||
|
||||
#define PLASMA_WIDTH 320
|
||||
#define PLASMA_HEIGHT 50
|
||||
#define SCREEN_W 640
|
||||
|
||||
static int16 *copySettings(const int16 *settings, size_t size) {
|
||||
int16 *buf = (int16 *)malloc(size);
|
||||
if (buf == nullptr) {
|
||||
@ -306,7 +302,7 @@ void Menu::plasmaEffectRenderFrame() {
|
||||
*(dest++) = *(src++);
|
||||
}
|
||||
|
||||
void Menu::processPlasmaEffect(int32 left, int32 top, int32 right, int32 color) {
|
||||
void Menu::processPlasmaEffect(int32 left, int32 top, int32 color) {
|
||||
const int32 max_value = color + 15;
|
||||
|
||||
plasmaEffectRenderFrame();
|
||||
@ -318,11 +314,11 @@ void Menu::processPlasmaEffect(int32 left, int32 top, int32 right, int32 color)
|
||||
for (int32 j = 0; j < kMainMenuButtonWidth; j++) {
|
||||
const uint8 c = MIN(in[i * kMainMenuButtonWidth + j] / 2 + color, max_value);
|
||||
/* 2x2 squares sharing the same pixel color: */
|
||||
const int32 target = 2 * (i * SCREEN_W + j);
|
||||
const int32 target = 2 * (i * DEFAULT_SCREEN_WIDTH + j);
|
||||
out[target + 0] = c;
|
||||
out[target + 1] = c;
|
||||
out[target + SCREEN_W + 0] = c;
|
||||
out[target + SCREEN_W + 1] = c;
|
||||
out[target + DEFAULT_SCREEN_WIDTH + 0] = c;
|
||||
out[target + DEFAULT_SCREEN_WIDTH + 1] = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -373,13 +369,13 @@ void Menu::drawButtonGfx(int32 width, int32 topheight, int32 buttonId, int32 tex
|
||||
}
|
||||
};
|
||||
|
||||
processPlasmaEffect(left, top, right, 80);
|
||||
processPlasmaEffect(left, top, 80);
|
||||
if (!(_engine->getRandomNumber() % 5)) {
|
||||
plasmaEffectPtr[_engine->getRandomNumber() % 140 * 10 + 1900] = 255;
|
||||
}
|
||||
_engine->_interface->drawSplittedBox(newWidth, top, right, bottom, 68);
|
||||
} else {
|
||||
processPlasmaEffect(left, top, right, 64);
|
||||
processPlasmaEffect(left, top, 64);
|
||||
if (!(_engine->getRandomNumber() % 5)) {
|
||||
plasmaEffectPtr[_engine->getRandomNumber() % 320 * 10 + 6400] = 255;
|
||||
}
|
||||
|
@ -38,6 +38,9 @@ enum MenuSettingsType {
|
||||
MenuSettings_FirstButton = 5
|
||||
};
|
||||
|
||||
#define PLASMA_WIDTH 320
|
||||
#define PLASMA_HEIGHT 50
|
||||
|
||||
class Menu {
|
||||
private:
|
||||
TwinEEngine *_engine;
|
||||
@ -116,7 +119,7 @@ public:
|
||||
* @param top top height where the effect will be draw in the front buffer
|
||||
* @param color plasma effect start color
|
||||
*/
|
||||
void processPlasmaEffect(int32 left, int32 top, int32 right, int32 color);
|
||||
void processPlasmaEffect(int32 left, int32 top, int32 color);
|
||||
|
||||
/**
|
||||
* Draw the entire button box
|
||||
|
@ -154,22 +154,19 @@ void MenuOptions::drawSelectableCharacters() {
|
||||
}
|
||||
}
|
||||
|
||||
// 0001F18C
|
||||
void MenuOptions::drawPlayerName(int32 centerx, int32 top, int32 type) {
|
||||
const int left = _engine->_text->dialTextBoxLeft;
|
||||
const int right = _engine->_text->dialTextBoxRight;
|
||||
if (type == 1) {
|
||||
_engine->_menu->processPlasmaEffect(left, top, right, 32);
|
||||
_engine->_menu->processPlasmaEffect(left, top, 32);
|
||||
}
|
||||
|
||||
const int right = SCREEN_WIDTH - 1; //_engine->_text->dialTextBoxRight; // FIXME: dialTextBoxRight is 0 here
|
||||
const int bottom = _engine->_text->dialTextBoxBottom;
|
||||
_engine->_menu->drawBox(left, top, right, bottom);
|
||||
_engine->_interface->drawTransparentBox(left + 1, top + 1, right - 1, bottom - 1, 3);
|
||||
|
||||
_engine->_text->drawText(centerx - _engine->_text->getTextSize(playerName) / 2, top, playerName);
|
||||
|
||||
_engine->flip();
|
||||
// TODO: _engine->copyBlockPhys(left, top, right, bottom);
|
||||
_engine->copyBlockPhys(left, top, right, top + PLASMA_HEIGHT);
|
||||
}
|
||||
|
||||
bool MenuOptions::enterPlayerName(int32 textIdx) {
|
||||
@ -278,9 +275,9 @@ bool MenuOptions::enterPlayerName(int32 textIdx) {
|
||||
if (_engine->shouldQuit()) {
|
||||
break;
|
||||
}
|
||||
_engine->_system->delayMillis(10);
|
||||
drawPlayerName(halfScreenWidth, 100, 1);
|
||||
drawSelectableCharacters();
|
||||
_engine->_system->delayMillis(1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -860,6 +860,9 @@ void TwinEEngine::copyBlockPhys(int32 left, int32 top, int32 right, int32 bottom
|
||||
assert(top <= bottom);
|
||||
const int32 width = right - left + 1;
|
||||
const int32 height = bottom - top + 1;
|
||||
if (width <= 0 || height <= 0) {
|
||||
return;
|
||||
}
|
||||
g_system->copyRectToScreen(frontVideoBuffer.getBasePtr(left, top), frontVideoBuffer.pitch, left, top, width, height);
|
||||
g_system->updateScreen();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user