TWINE: cleanup in debug window

This commit is contained in:
Martin Gerhardy 2020-11-03 18:23:48 +01:00
parent cf8e7339d0
commit 92b68a1132
3 changed files with 18 additions and 17 deletions

View File

@ -392,13 +392,10 @@ void Debug::debugLeftMenu() {
debugAddButton(ZONES_MENU, 205, 244, 350, 264, "Ladder Zones", 215, 249, 7, 87, 119, 0, SHOW_ZONE_LADDER);
}
int32 Debug::debugProcessButton(int32 X, int32 Y) {
int32 i;
int32 j;
for (i = 0; i < numDebugWindows; i++) {
for (j = 0; j < debugWindows[i].numButtons; j++) {
if (X > (debugWindows[i].debugButtons[j].left) && X < (debugWindows[i].debugButtons[j].right) && Y > (debugWindows[i].debugButtons[j].top) && Y < (debugWindows[i].debugButtons[j].bottom)) {
int32 Debug::debugProcessButton(int32 x, int32 y) {
for (int32 i = 0; i < numDebugWindows; i++) {
for (int32 j = 0; j < debugWindows[i].numButtons; j++) {
if (x > (debugWindows[i].debugButtons[j].left) && x < (debugWindows[i].debugButtons[j].right) && y > (debugWindows[i].debugButtons[j].top) && y < (debugWindows[i].debugButtons[j].bottom)) {
return (debugWindows[i].debugButtons[j].type);
}
}
@ -433,8 +430,9 @@ void Debug::debugProcessWindow() {
_engine->_screens->copyScreen(_engine->frontVideoBuffer, _engine->workVideoBuffer);
debugResetButtonsState();
if (numDebugWindows == 0)
if (numDebugWindows == 0) {
debugLeftMenu();
}
debugDrawWindows();
do {

View File

@ -39,17 +39,21 @@ void DebugScene::drawBoundingBoxProjectPoints(ScenePoint *pPoint3d, ScenePoint *
pPoint3dProjected->y = _engine->_renderer->projPosY;
pPoint3dProjected->z = _engine->_renderer->projPosZ;
if (_engine->_redraw->renderLeft > _engine->_renderer->projPosX)
if (_engine->_redraw->renderLeft > _engine->_renderer->projPosX) {
_engine->_redraw->renderLeft = _engine->_renderer->projPosX;
}
if (_engine->_redraw->renderRight < _engine->_renderer->projPosX)
if (_engine->_redraw->renderRight < _engine->_renderer->projPosX) {
_engine->_redraw->renderRight = _engine->_renderer->projPosX;
}
if (_engine->_redraw->renderTop > _engine->_renderer->projPosY)
if (_engine->_redraw->renderTop > _engine->_renderer->projPosY) {
_engine->_redraw->renderTop = _engine->_renderer->projPosY;
}
if (_engine->_redraw->renderBottom < _engine->_renderer->projPosY)
if (_engine->_redraw->renderBottom < _engine->_renderer->projPosY) {
_engine->_redraw->renderBottom = _engine->_renderer->projPosY;
}
}
int32 DebugScene::checkZoneType(int32 type) {
@ -123,8 +127,6 @@ void DebugScene::displayZones() {
ScenePoint backTopLeftPoint2D;
ScenePoint backTopRightPoint2D;
uint8 color;
// compute the points in 3D
frontBottomLeftPoint.x = zonePtr->bottomLeft.x - _engine->_grid->cameraX;
@ -172,7 +174,7 @@ void DebugScene::displayZones() {
// draw all lines
color = 15 * 3 + zonePtr->type * 16;
uint8 color = 15 * 3 + zonePtr->type * 16;
// draw front part
_engine->_interface->drawLine(frontBottomLeftPoint2D.x, frontBottomLeftPoint2D.y, frontTopLeftPoint2D.x, frontTopLeftPoint2D.y, color);
@ -198,6 +200,7 @@ void DebugScene::displayZones() {
_engine->_interface->drawLine(backBottomRightPoint2D.x, backBottomRightPoint2D.y, frontBottomRightPoint2D.x, frontBottomRightPoint2D.y, color);
_engine->_interface->drawLine(frontBottomRightPoint2D.x, frontBottomRightPoint2D.y, frontBottomLeftPoint2D.x, frontBottomLeftPoint2D.y, color);
}
_engine->flip();
}
} // namespace TwinE

View File

@ -362,12 +362,12 @@ void Movements::processActorMovements(int32 actorIdx) {
heroMoved = false;
if (_engine->_input->isActionActive(TwinEActionType::MoveForward)) { // walk forward
if (_engine->_input->isActionActive(TwinEActionType::MoveForward)) {
if (!_engine->_scene->currentActorInZone) {
_engine->_animations->initAnim(kForward, 0, 255, actorIdx);
}
heroMoved = true;
} else if (_engine->_input->isActionActive(TwinEActionType::MoveBackward)) { // walk backward
} else if (_engine->_input->isActionActive(TwinEActionType::MoveBackward)) {
_engine->_animations->initAnim(kBackward, 0, 255, actorIdx);
heroMoved = true;
}