TWINE: converted to boolean

This commit is contained in:
Martin Gerhardy 2020-10-22 18:42:01 +02:00 committed by Eugene Sandulenko
parent 60e7cbfe11
commit 0766f49c23
9 changed files with 119 additions and 119 deletions

View File

@ -173,8 +173,8 @@ void Collision::reajustActorPosition(int32 brickShape) {
}
break;
default:
if (_engine->cfgfile.Debug == 1) {
debug("Brick Shape %d unsupported\n", brickShape);
if (_engine->cfgfile.Debug) {
debug("Brick Shape %d unsupported", brickShape);
}
break;
}

View File

@ -203,13 +203,13 @@ int32 Debug::debugGetActionsState(int32 type) {
switch (type) {
case FREE_CAMERA:
state = _engine->_debugGrid->useFreeCamera;
state = _engine->_debugGrid->useFreeCamera ? 1 : 0;
break;
case CHANGE_SCENE:
state = _engine->_debugGrid->canChangeScenes;
state = _engine->_debugGrid->canChangeScenes ? 1 : 0;
break;
case SHOW_ZONES:
state = _engine->_debugScene->showingZones;
state = _engine->_debugScene->showingZones ? 1 : 0;
break;
case SHOW_ZONE_CUBE:
case SHOW_ZONE_CAMERA:

View File

@ -31,7 +31,7 @@
namespace TwinE {
DebugGrid::DebugGrid(TwinEEngine *engine) : _engine(engine) {
canChangeScenes = _engine->cfgfile.Debug ? 1 : 0;
canChangeScenes = _engine->cfgfile.Debug;
}
void DebugGrid::changeGridCamera(int16 pKey) {

View File

@ -36,8 +36,8 @@ private:
public:
DebugGrid(TwinEEngine *engine);
int32 useFreeCamera = 0;
int32 canChangeScenes = 0;
bool useFreeCamera = false;
bool canChangeScenes = false;
/** Change scenario camera positions */
void changeGridCamera(int16 pKey);

View File

@ -45,7 +45,7 @@ void DebugScene::drawBoundingBoxProjectPoints(ScenePoint *pPoint3d, ScenePoint *
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)
@ -90,113 +90,113 @@ int32 DebugScene::checkZoneType(int32 type) {
}
void DebugScene::displayZones(int16 pKey) {
if (showingZones == 1) {
int z;
ZoneStruct *zonePtr = _engine->_scene->sceneZones;
for (z = 0; z < _engine->_scene->sceneNumZones; z++) {
zonePtr = &_engine->_scene->sceneZones[z];
if (!showingZones) {
return;
}
for (int z = 0; z < _engine->_scene->sceneNumZones; z++) {
const ZoneStruct *zonePtr = &_engine->_scene->sceneZones[z];
if (checkZoneType(zonePtr->type)) {
ScenePoint frontBottomLeftPoint;
ScenePoint frontBottomRightPoint;
ScenePoint frontTopLeftPoint;
ScenePoint frontTopRightPoint;
ScenePoint backBottomLeftPoint;
ScenePoint backBottomRightPoint;
ScenePoint backTopLeftPoint;
ScenePoint backTopRightPoint;
ScenePoint frontBottomLeftPoint2D;
ScenePoint frontBottomRightPoint2D;
ScenePoint frontTopLeftPoint2D;
ScenePoint frontTopRightPoint2D;
ScenePoint backBottomLeftPoint2D;
ScenePoint backBottomRightPoint2D;
ScenePoint backTopLeftPoint2D;
ScenePoint backTopRightPoint2D;
uint8 color;
// compute the points in 3D
frontBottomLeftPoint.x = zonePtr->bottomLeft.x - _engine->_grid->cameraX;
frontBottomLeftPoint.y = zonePtr->bottomLeft.y - _engine->_grid->cameraY;
frontBottomLeftPoint.z = zonePtr->topRight.z - _engine->_grid->cameraZ;
frontBottomRightPoint.x = zonePtr->topRight.x - _engine->_grid->cameraX;
frontBottomRightPoint.y = zonePtr->bottomLeft.y - _engine->_grid->cameraY;
frontBottomRightPoint.z = zonePtr->topRight.z - _engine->_grid->cameraZ;
frontTopLeftPoint.x = zonePtr->bottomLeft.x - _engine->_grid->cameraX;
frontTopLeftPoint.y = zonePtr->topRight.y - _engine->_grid->cameraY;
frontTopLeftPoint.z = zonePtr->topRight.z - _engine->_grid->cameraZ;
frontTopRightPoint.x = zonePtr->topRight.x - _engine->_grid->cameraX;
frontTopRightPoint.y = zonePtr->topRight.y - _engine->_grid->cameraY;
frontTopRightPoint.z = zonePtr->topRight.z - _engine->_grid->cameraZ;
backBottomLeftPoint.x = zonePtr->bottomLeft.x - _engine->_grid->cameraX;
backBottomLeftPoint.y = zonePtr->bottomLeft.y - _engine->_grid->cameraY;
backBottomLeftPoint.z = zonePtr->bottomLeft.z - _engine->_grid->cameraZ;
backBottomRightPoint.x = zonePtr->topRight.x - _engine->_grid->cameraX;
backBottomRightPoint.y = zonePtr->bottomLeft.y - _engine->_grid->cameraY;
backBottomRightPoint.z = zonePtr->bottomLeft.z - _engine->_grid->cameraZ;
backTopLeftPoint.x = zonePtr->bottomLeft.x - _engine->_grid->cameraX;
backTopLeftPoint.y = zonePtr->topRight.y - _engine->_grid->cameraY;
backTopLeftPoint.z = zonePtr->bottomLeft.z - _engine->_grid->cameraZ;
backTopRightPoint.x = zonePtr->topRight.x - _engine->_grid->cameraX;
backTopRightPoint.y = zonePtr->topRight.y - _engine->_grid->cameraY;
backTopRightPoint.z = zonePtr->bottomLeft.z - _engine->_grid->cameraZ;
// project all points
drawBoundingBoxProjectPoints(&frontBottomLeftPoint, &frontBottomLeftPoint2D);
drawBoundingBoxProjectPoints(&frontBottomRightPoint, &frontBottomRightPoint2D);
drawBoundingBoxProjectPoints(&frontTopLeftPoint, &frontTopLeftPoint2D);
drawBoundingBoxProjectPoints(&frontTopRightPoint, &frontTopRightPoint2D);
drawBoundingBoxProjectPoints(&backBottomLeftPoint, &backBottomLeftPoint2D);
drawBoundingBoxProjectPoints(&backBottomRightPoint, &backBottomRightPoint2D);
drawBoundingBoxProjectPoints(&backTopLeftPoint, &backTopLeftPoint2D);
drawBoundingBoxProjectPoints(&backTopRightPoint, &backTopRightPoint2D);
// draw all lines
color = 15 * 3 + zonePtr->type * 16;
// draw front part
_engine->_interface->drawLine(frontBottomLeftPoint2D.x, frontBottomLeftPoint2D.y, frontTopLeftPoint2D.x, frontTopLeftPoint2D.y, color);
_engine->_interface->drawLine(frontTopLeftPoint2D.x, frontTopLeftPoint2D.y, frontTopRightPoint2D.x, frontTopRightPoint2D.y, color);
_engine->_interface->drawLine(frontTopRightPoint2D.x, frontTopRightPoint2D.y, frontBottomRightPoint2D.x, frontBottomRightPoint2D.y, color);
_engine->_interface->drawLine(frontBottomRightPoint2D.x, frontBottomRightPoint2D.y, frontBottomLeftPoint2D.x, frontBottomLeftPoint2D.y, color);
// draw top part
_engine->_interface->drawLine(frontTopLeftPoint2D.x, frontTopLeftPoint2D.y, backTopLeftPoint2D.x, backTopLeftPoint2D.y, color);
_engine->_interface->drawLine(backTopLeftPoint2D.x, backTopLeftPoint2D.y, backTopRightPoint2D.x, backTopRightPoint2D.y, color);
_engine->_interface->drawLine(backTopRightPoint2D.x, backTopRightPoint2D.y, frontTopRightPoint2D.x, frontTopRightPoint2D.y, color);
_engine->_interface->drawLine(frontTopRightPoint2D.x, frontTopRightPoint2D.y, frontTopLeftPoint2D.x, frontTopLeftPoint2D.y, color);
// draw back part
_engine->_interface->drawLine(backBottomLeftPoint2D.x, backBottomLeftPoint2D.y, backTopLeftPoint2D.x, backTopLeftPoint2D.y, color);
_engine->_interface->drawLine(backTopLeftPoint2D.x, backTopLeftPoint2D.y, backTopRightPoint2D.x, backTopRightPoint2D.y, color);
_engine->_interface->drawLine(backTopRightPoint2D.x, backTopRightPoint2D.y, backBottomRightPoint2D.x, backBottomRightPoint2D.y, color);
_engine->_interface->drawLine(backBottomRightPoint2D.x, backBottomRightPoint2D.y, backBottomLeftPoint2D.x, backBottomLeftPoint2D.y, color);
// draw bottom part
_engine->_interface->drawLine(frontBottomLeftPoint2D.x, frontBottomLeftPoint2D.y, backBottomLeftPoint2D.x, backBottomLeftPoint2D.y, color);
_engine->_interface->drawLine(backBottomLeftPoint2D.x, backBottomLeftPoint2D.y, backBottomRightPoint2D.x, backBottomRightPoint2D.y, color);
_engine->_interface->drawLine(backBottomRightPoint2D.x, backBottomRightPoint2D.y, frontBottomRightPoint2D.x, frontBottomRightPoint2D.y, color);
_engine->_interface->drawLine(frontBottomRightPoint2D.x, frontBottomRightPoint2D.y, frontBottomLeftPoint2D.x, frontBottomLeftPoint2D.y, color);
}
if (!checkZoneType(zonePtr->type)) {
continue;
}
ScenePoint frontBottomLeftPoint;
ScenePoint frontBottomRightPoint;
ScenePoint frontTopLeftPoint;
ScenePoint frontTopRightPoint;
ScenePoint backBottomLeftPoint;
ScenePoint backBottomRightPoint;
ScenePoint backTopLeftPoint;
ScenePoint backTopRightPoint;
ScenePoint frontBottomLeftPoint2D;
ScenePoint frontBottomRightPoint2D;
ScenePoint frontTopLeftPoint2D;
ScenePoint frontTopRightPoint2D;
ScenePoint backBottomLeftPoint2D;
ScenePoint backBottomRightPoint2D;
ScenePoint backTopLeftPoint2D;
ScenePoint backTopRightPoint2D;
uint8 color;
// compute the points in 3D
frontBottomLeftPoint.x = zonePtr->bottomLeft.x - _engine->_grid->cameraX;
frontBottomLeftPoint.y = zonePtr->bottomLeft.y - _engine->_grid->cameraY;
frontBottomLeftPoint.z = zonePtr->topRight.z - _engine->_grid->cameraZ;
frontBottomRightPoint.x = zonePtr->topRight.x - _engine->_grid->cameraX;
frontBottomRightPoint.y = zonePtr->bottomLeft.y - _engine->_grid->cameraY;
frontBottomRightPoint.z = zonePtr->topRight.z - _engine->_grid->cameraZ;
frontTopLeftPoint.x = zonePtr->bottomLeft.x - _engine->_grid->cameraX;
frontTopLeftPoint.y = zonePtr->topRight.y - _engine->_grid->cameraY;
frontTopLeftPoint.z = zonePtr->topRight.z - _engine->_grid->cameraZ;
frontTopRightPoint.x = zonePtr->topRight.x - _engine->_grid->cameraX;
frontTopRightPoint.y = zonePtr->topRight.y - _engine->_grid->cameraY;
frontTopRightPoint.z = zonePtr->topRight.z - _engine->_grid->cameraZ;
backBottomLeftPoint.x = zonePtr->bottomLeft.x - _engine->_grid->cameraX;
backBottomLeftPoint.y = zonePtr->bottomLeft.y - _engine->_grid->cameraY;
backBottomLeftPoint.z = zonePtr->bottomLeft.z - _engine->_grid->cameraZ;
backBottomRightPoint.x = zonePtr->topRight.x - _engine->_grid->cameraX;
backBottomRightPoint.y = zonePtr->bottomLeft.y - _engine->_grid->cameraY;
backBottomRightPoint.z = zonePtr->bottomLeft.z - _engine->_grid->cameraZ;
backTopLeftPoint.x = zonePtr->bottomLeft.x - _engine->_grid->cameraX;
backTopLeftPoint.y = zonePtr->topRight.y - _engine->_grid->cameraY;
backTopLeftPoint.z = zonePtr->bottomLeft.z - _engine->_grid->cameraZ;
backTopRightPoint.x = zonePtr->topRight.x - _engine->_grid->cameraX;
backTopRightPoint.y = zonePtr->topRight.y - _engine->_grid->cameraY;
backTopRightPoint.z = zonePtr->bottomLeft.z - _engine->_grid->cameraZ;
// project all points
drawBoundingBoxProjectPoints(&frontBottomLeftPoint, &frontBottomLeftPoint2D);
drawBoundingBoxProjectPoints(&frontBottomRightPoint, &frontBottomRightPoint2D);
drawBoundingBoxProjectPoints(&frontTopLeftPoint, &frontTopLeftPoint2D);
drawBoundingBoxProjectPoints(&frontTopRightPoint, &frontTopRightPoint2D);
drawBoundingBoxProjectPoints(&backBottomLeftPoint, &backBottomLeftPoint2D);
drawBoundingBoxProjectPoints(&backBottomRightPoint, &backBottomRightPoint2D);
drawBoundingBoxProjectPoints(&backTopLeftPoint, &backTopLeftPoint2D);
drawBoundingBoxProjectPoints(&backTopRightPoint, &backTopRightPoint2D);
// draw all lines
color = 15 * 3 + zonePtr->type * 16;
// draw front part
_engine->_interface->drawLine(frontBottomLeftPoint2D.x, frontBottomLeftPoint2D.y, frontTopLeftPoint2D.x, frontTopLeftPoint2D.y, color);
_engine->_interface->drawLine(frontTopLeftPoint2D.x, frontTopLeftPoint2D.y, frontTopRightPoint2D.x, frontTopRightPoint2D.y, color);
_engine->_interface->drawLine(frontTopRightPoint2D.x, frontTopRightPoint2D.y, frontBottomRightPoint2D.x, frontBottomRightPoint2D.y, color);
_engine->_interface->drawLine(frontBottomRightPoint2D.x, frontBottomRightPoint2D.y, frontBottomLeftPoint2D.x, frontBottomLeftPoint2D.y, color);
// draw top part
_engine->_interface->drawLine(frontTopLeftPoint2D.x, frontTopLeftPoint2D.y, backTopLeftPoint2D.x, backTopLeftPoint2D.y, color);
_engine->_interface->drawLine(backTopLeftPoint2D.x, backTopLeftPoint2D.y, backTopRightPoint2D.x, backTopRightPoint2D.y, color);
_engine->_interface->drawLine(backTopRightPoint2D.x, backTopRightPoint2D.y, frontTopRightPoint2D.x, frontTopRightPoint2D.y, color);
_engine->_interface->drawLine(frontTopRightPoint2D.x, frontTopRightPoint2D.y, frontTopLeftPoint2D.x, frontTopLeftPoint2D.y, color);
// draw back part
_engine->_interface->drawLine(backBottomLeftPoint2D.x, backBottomLeftPoint2D.y, backTopLeftPoint2D.x, backTopLeftPoint2D.y, color);
_engine->_interface->drawLine(backTopLeftPoint2D.x, backTopLeftPoint2D.y, backTopRightPoint2D.x, backTopRightPoint2D.y, color);
_engine->_interface->drawLine(backTopRightPoint2D.x, backTopRightPoint2D.y, backBottomRightPoint2D.x, backBottomRightPoint2D.y, color);
_engine->_interface->drawLine(backBottomRightPoint2D.x, backBottomRightPoint2D.y, backBottomLeftPoint2D.x, backBottomLeftPoint2D.y, color);
// draw bottom part
_engine->_interface->drawLine(frontBottomLeftPoint2D.x, frontBottomLeftPoint2D.y, backBottomLeftPoint2D.x, backBottomLeftPoint2D.y, color);
_engine->_interface->drawLine(backBottomLeftPoint2D.x, backBottomLeftPoint2D.y, backBottomRightPoint2D.x, backBottomRightPoint2D.y, color);
_engine->_interface->drawLine(backBottomRightPoint2D.x, backBottomRightPoint2D.y, frontBottomRightPoint2D.x, frontBottomRightPoint2D.y, color);
_engine->_interface->drawLine(frontBottomRightPoint2D.x, frontBottomRightPoint2D.y, frontBottomLeftPoint2D.x, frontBottomLeftPoint2D.y, color);
}
}

View File

@ -38,7 +38,7 @@ private:
int32 checkZoneType(int32 type);
public:
DebugScene(TwinEEngine *engine);
int32 showingZones = 0;
bool showingZones = false;
int32 typeZones = 127; // all zones on as default
void displayZones(int16 pKey);

View File

@ -259,13 +259,13 @@ int32 MenuOptions::enterPlayerName(int32 textIdx) {
enterPlayerNameVar2 = 0;
_engine->_screens->copyScreen(_engine->workVideoBuffer, _engine->frontVideoBuffer);
_engine->flip(); // frontVideoBuffer
_engine->flip();
return 1;
}
void MenuOptions::newGameMenu() {
//TODO: process players name
// TODO: process players name
if (enterPlayerName(MAINMENU_ENTERPLAYERNAME)) {
_engine->_gameState->initEngineVars();
newGame();

View File

@ -226,7 +226,7 @@ void TwinEEngine::initConfigurations() {
cfgfile.Movie = ConfGetIntOrDefault("Movie", CONF_MOVIE_FLA);
cfgfile.CrossFade = ConfGetIntOrDefault("CrossFade", 0);
cfgfile.Fps = ConfGetIntOrDefault("Fps", DEFAULT_FRAMES_PER_SECOND);
cfgfile.Debug = ConfGetIntOrDefault("Debug", 0);
cfgfile.Debug = ConfGetIntOrDefault("Debug", 0) == 1;
cfgfile.UseAutoSaving = ConfGetIntOrDefault("UseAutoSaving", 0);
cfgfile.AutoAgressive = ConfGetIntOrDefault("CombatAuto", 0);
cfgfile.ShadowMode = ConfGetIntOrDefault("Shadow", 0);

View File

@ -109,7 +109,7 @@ struct ConfigFile {
/** Flag used to keep the game frames per second */
int32 Fps = 0;
/** Flag to display game debug */
int32 Debug = 0;
bool Debug = false;
/** Use original autosaving system or save when you want */
int32 UseAutoSaving = 0;
/** Shadow mode type */