TWINE: convert to boolean

This commit is contained in:
Martin Gerhardy 2020-10-22 12:42:57 +02:00 committed by Eugene Sandulenko
parent e1ec83207f
commit 18e7620613
12 changed files with 54 additions and 54 deletions

View File

@ -479,7 +479,7 @@ void Debug::debugProcessWindow() {
count++;
} while (!quit);
_engine->_redraw->reqBgRedraw = 1;
_engine->_redraw->reqBgRedraw = true;
}
}

View File

@ -39,25 +39,25 @@ void DebugGrid::changeGridCamera(int16 pKey) {
// Press up - more X positions
if (pKey == twineactions[TwinEActionType::DebugGridCameraPressUp].localKey) {
_engine->_grid->newCameraZ--;
_engine->_redraw->reqBgRedraw = 1;
_engine->_redraw->reqBgRedraw = true;
}
// Press down - less X positions
else if (pKey == twineactions[TwinEActionType::DebugGridCameraPressDown].localKey) {
_engine->_grid->newCameraZ++;
_engine->_redraw->reqBgRedraw = 1;
_engine->_redraw->reqBgRedraw = true;
}
// Press left - less Z positions
else if (pKey == twineactions[TwinEActionType::DebugGridCameraPressLeft].localKey) {
_engine->_grid->newCameraX--;
_engine->_redraw->reqBgRedraw = 1;
_engine->_redraw->reqBgRedraw = true;
}
// Press right - more Z positions
else if (pKey == twineactions[TwinEActionType::DebugGridCameraPressRight].localKey) {
_engine->_grid->newCameraX++;
_engine->_redraw->reqBgRedraw = 1;
_engine->_redraw->reqBgRedraw = true;
}
}
}
@ -72,7 +72,7 @@ void DebugGrid::changeGrid(int16 pKey) {
if (_engine->_scene->currentSceneIdx > NUM_SCENES)
_engine->_scene->currentSceneIdx = 0;
_engine->_scene->needChangeScene = _engine->_scene->currentSceneIdx;
_engine->_redraw->reqBgRedraw = 1;
_engine->_redraw->reqBgRedraw = true;
}
// Press down - less X positions
@ -81,7 +81,7 @@ void DebugGrid::changeGrid(int16 pKey) {
if (_engine->_scene->currentSceneIdx < 0)
_engine->_scene->currentSceneIdx = NUM_SCENES;
_engine->_scene->needChangeScene = _engine->_scene->currentSceneIdx;
_engine->_redraw->reqBgRedraw = 1;
_engine->_redraw->reqBgRedraw = true;
}
}
@ -109,7 +109,7 @@ void DebugGrid::applyCellingGrid(int16 pKey) {
} else if (_engine->_grid->useCellingGrid == 1) {
_engine->_grid->useCellingGrid = -1;
_engine->_grid->createGridMap();
_engine->_redraw->reqBgRedraw = 1;
_engine->_redraw->reqBgRedraw = true;
debug("Disable Celling Grid index: %d", _engine->_grid->cellingGridIdx);
_engine->_scene->needChangeScene = -2; // tricky to make the fade
}

View File

@ -439,7 +439,7 @@ int32 Grid::initCellingGrid(int32 index) {
if (gridPtr)
free(gridPtr);
_engine->_redraw->reqBgRedraw = 1;
_engine->_redraw->reqBgRedraw = true;
return 0;
}

View File

@ -719,7 +719,7 @@ void Redraw::redrawEngineActions(int32 bgRedraw) { // fullRedraw
} else {
_engine->_screens->fadeToPal(_engine->_screens->mainPaletteRGBA);
}
_engine->_screens->lockPalette = 0;
_engine->_screens->lockPalette = false;
}
if (_engine->zoomScreen) {

View File

@ -113,10 +113,10 @@ public:
/** Auxiliar object render bottom position on screen */
int32 renderBottom = 0;
int16 drawInGameTransBox = 0;
bool drawInGameTransBox = false;
/** Request background redraw */
int16 reqBgRedraw = 0;
bool reqBgRedraw = false;
/** Current number of redraw regions in the screen */
int32 currNumOfRedrawBox = 0; // fullRedrawVar8

View File

@ -40,7 +40,7 @@ void Resources::initPalettes() {
_engine->setPalette(_engine->_screens->paletteRGBA);
// We use it now
_engine->_screens->palCustom = 0;
_engine->_screens->palCustom = false;
}
void Resources::preloadSprites() {

View File

@ -299,7 +299,7 @@ void Scene::resetScene() {
}
_engine->_actor->currentPositionInBodyPtrTab = 0;
_engine->_screens->useAlternatePalette = 0;
_engine->_screens->useAlternatePalette = false;
}
void Scene::changeScene() {
@ -377,8 +377,8 @@ void Scene::changeScene() {
_engine->_movements->heroMoved = 1;
_engine->_grid->useCellingGrid = -1;
_engine->_grid->cellingGridIdx = -1;
_engine->_redraw->reqBgRedraw = 1;
_engine->_screens->lockPalette = 0;
_engine->_redraw->reqBgRedraw = true;
_engine->_screens->lockPalette = false;
needChangeScene = -1;
changeRoomVar10 = 1;
@ -500,7 +500,7 @@ void Scene::processActorZones(int32 actorIdx) {
_engine->_grid->newCameraX = zone->infoData.CameraView.x;
_engine->_grid->newCameraY = zone->infoData.CameraView.y;
_engine->_grid->newCameraZ = zone->infoData.CameraView.z;
_engine->_redraw->reqBgRedraw = 1;
_engine->_redraw->reqBgRedraw = true;
}
}
break;
@ -565,7 +565,7 @@ void Scene::processActorZones(int32 actorIdx) {
_engine->_grid->useCellingGrid = -1;
_engine->_grid->cellingGridIdx = -1;
_engine->_grid->createGridMap();
_engine->_redraw->reqBgRedraw = 1;
_engine->_redraw->reqBgRedraw = true;
}
}

View File

@ -36,7 +36,7 @@ void Screens::adelineLogo() {
loadImage(RESSHQR_ADELINEIMG);
_engine->delaySkip(7000);
fadeOut(paletteRGBACustom);
palCustom = 1;
palCustom = true;
}
void Screens::loadMenuImage(bool fade_in) {
@ -48,7 +48,7 @@ void Screens::loadMenuImage(bool fade_in) {
_engine->setPalette(paletteRGBA);
}
palCustom = 0;
palCustom = false;
}
void Screens::loadCustomPalette(int32 index) {
@ -77,7 +77,7 @@ void Screens::loadImage(int32 index, bool fade_in) {
_engine->setPalette(paletteRGBACustom);
}
palCustom = 1;
palCustom = true;
}
void Screens::loadImageDelay(int32 index, int32 time) {
@ -181,14 +181,14 @@ void Screens::adjustCrossPalette(const uint32 *pal1, const uint32 *pal2) {
void Screens::fadeToBlack(uint32 *pal) {
int32 i = 0;
if (palReseted == 0) {
if (!palResetted) {
for (i = 100; i >= 0; i -= 3) {
adjustPalette(0, 0, 0, pal, i);
_engine->_system->delayMillis(1000 / 50);
}
}
palReseted = 1;
palResetted = true;
}
void Screens::fadeToPal(uint32 *pal) {
@ -201,7 +201,7 @@ void Screens::fadeToPal(uint32 *pal) {
_engine->setPalette(pal);
palReseted = 0;
palResetted = false;
}
void Screens::blackToWhite() {
@ -220,7 +220,7 @@ void Screens::setBackPal() {
_engine->setPalette(paletteRGBA);
palReseted = 1;
palResetted = true;
}
void Screens::fadePalRed(uint32 *pal) {

View File

@ -48,16 +48,16 @@ public:
uint32 paletteRGBACustom[NUMOFCOLORS]{0};
/** flag to check if a custom palette is in use */
int16 palCustom = 0;
bool palCustom = false;
/** flag to check in the game palette was changed */
int16 palReseted = 0;
bool palResetted = false;
/** flag to check if the main flag is locked */
int16 lockPalette = 0;
bool lockPalette = false;
/** flag to check if we are using a different palette than the main one */
int16 useAlternatePalette = 0;
bool useAlternatePalette = false;
/** main game palette */
uint8 *mainPalette = nullptr;

View File

@ -625,7 +625,7 @@ static int32 lCAM_FOLLOW(TwinEEngine *engine, int32 actorIdx, ActorStruct *actor
engine->_grid->newCameraZ = engine->_scene->sceneActors[followedActorIdx].z >> 9;
engine->_scene->currentlyFollowedActor = followedActorIdx;
engine->_redraw->reqBgRedraw = 1;
engine->_redraw->reqBgRedraw = true;
}
return 0;
@ -945,13 +945,13 @@ static int32 lZOOM(TwinEEngine *engine, int32 actorIdx, ActorStruct *actor) {
engine->_screens->fadeToBlack(engine->_screens->mainPaletteRGBA);
engine->initMCGA();
engine->_screens->setBackPal();
engine->_screens->lockPalette = 1;
engine->_screens->lockPalette = true;
} else if (!engine->zoomScreen && engine->_redraw->drawInGameTransBox) {
engine->_screens->fadeToBlack(engine->_screens->mainPaletteRGBA);
engine->initSVGA();
engine->_screens->setBackPal();
engine->_screens->lockPalette = 1;
engine->_redraw->reqBgRedraw = 1;
engine->_screens->lockPalette = true;
engine->_redraw->reqBgRedraw = true;
}
return 0;
@ -1219,7 +1219,7 @@ static int32 lGRM_OFF(TwinEEngine *engine, int32 actorIdx, ActorStruct *actor) {
static int32 lFADE_PAL_RED(TwinEEngine *engine, int32 actorIdx, ActorStruct *actor) {
engine->freezeTime();
engine->_screens->fadePalRed(engine->_screens->mainPaletteRGBA);
engine->_screens->useAlternatePalette = 0;
engine->_screens->useAlternatePalette = false;
engine->unfreezeTime();
return 0;
}
@ -1230,7 +1230,7 @@ static int32 lFADE_ALARM_RED(TwinEEngine *engine, int32 actorIdx, ActorStruct *a
engine->_hqrdepack->hqrGetEntry(engine->_screens->palette, Resources::HQR_RESS_FILE, RESSHQR_ALARMREDPAL);
engine->_screens->convertPalToRGBA(engine->_screens->palette, engine->_screens->paletteRGBA);
engine->_screens->fadePalRed(engine->_screens->paletteRGBA);
engine->_screens->useAlternatePalette = 1;
engine->_screens->useAlternatePalette = true;
engine->unfreezeTime();
return 0;
}
@ -1241,7 +1241,7 @@ static int32 lFADE_ALARM_PAL(TwinEEngine *engine, int32 actorIdx, ActorStruct *a
engine->_hqrdepack->hqrGetEntry(engine->_screens->palette, Resources::HQR_RESS_FILE, RESSHQR_ALARMREDPAL);
engine->_screens->convertPalToRGBA(engine->_screens->palette, engine->_screens->paletteRGBA);
engine->_screens->adjustCrossPalette(engine->_screens->paletteRGBA, engine->_screens->mainPaletteRGBA);
engine->_screens->useAlternatePalette = 0;
engine->_screens->useAlternatePalette = false;
engine->unfreezeTime();
return 0;
}
@ -1250,7 +1250,7 @@ static int32 lFADE_ALARM_PAL(TwinEEngine *engine, int32 actorIdx, ActorStruct *a
static int32 lFADE_RED_PAL(TwinEEngine *engine, int32 actorIdx, ActorStruct *actor) {
engine->freezeTime();
engine->_screens->fadeRedPal(engine->_screens->mainPaletteRGBA);
engine->_screens->useAlternatePalette = 0;
engine->_screens->useAlternatePalette = false;
engine->unfreezeTime();
return 0;
}
@ -1261,7 +1261,7 @@ static int32 lFADE_RED_ALARM(TwinEEngine *engine, int32 actorIdx, ActorStruct *a
engine->_hqrdepack->hqrGetEntry(engine->_screens->palette, Resources::HQR_RESS_FILE, RESSHQR_ALARMREDPAL);
engine->_screens->convertPalToRGBA(engine->_screens->palette, engine->_screens->paletteRGBA);
engine->_screens->fadeRedPal(engine->_screens->paletteRGBA);
engine->_screens->useAlternatePalette = 1;
engine->_screens->useAlternatePalette = true;
engine->unfreezeTime();
return 0;
}
@ -1272,7 +1272,7 @@ static int32 lFADE_PAL_ALARM(TwinEEngine *engine, int32 actorIdx, ActorStruct *a
engine->_hqrdepack->hqrGetEntry(engine->_screens->palette, Resources::HQR_RESS_FILE, RESSHQR_ALARMREDPAL);
engine->_screens->convertPalToRGBA(engine->_screens->palette, engine->_screens->paletteRGBA);
engine->_screens->adjustCrossPalette(engine->_screens->mainPaletteRGBA, engine->_screens->paletteRGBA);
engine->_screens->useAlternatePalette = 1;
engine->_screens->useAlternatePalette = true;
engine->unfreezeTime();
return 0;
}
@ -1326,14 +1326,14 @@ static int32 lSET_DARK_PAL(TwinEEngine *engine, int32 actorIdx, ActorStruct *act
engine->_screens->convertPalToRGBA(engine->_screens->palette, engine->_screens->paletteRGBA);
engine->setPalette(engine->_screens->paletteRGBA);
}
engine->_screens->useAlternatePalette = 1;
engine->_screens->useAlternatePalette = true;
engine->unfreezeTime();
return 0;
}
/*0x5D*/
static int32 lSET_NORMAL_PAL(TwinEEngine *engine, int32 actorIdx, ActorStruct *actor) {
engine->_screens->useAlternatePalette = 0;
engine->_screens->useAlternatePalette = false;
if (!engine->_screens->lockPalette) {
engine->setPalette(engine->_screens->mainPaletteRGBA);
}

View File

@ -298,14 +298,14 @@ static int32 mBACKGROUND(TwinEEngine *engine, int32 actorIdx, ActorStruct *actor
if (!actor->staticFlags.bIsBackgrounded) {
actor->staticFlags.bIsBackgrounded = 1;
if (actor->dynamicFlags.bIsVisible) {
engine->_redraw->reqBgRedraw = 1;
engine->_redraw->reqBgRedraw = true;
}
}
} else {
if (actor->staticFlags.bIsBackgrounded) {
actor->staticFlags.bIsBackgrounded = 0;
if (actor->dynamicFlags.bIsVisible) {
engine->_redraw->reqBgRedraw = 1;
engine->_redraw->reqBgRedraw = true;
}
}
}

View File

@ -265,11 +265,11 @@ void TwinEEngine::initEngine() {
}
void TwinEEngine::initMCGA() {
_redraw->drawInGameTransBox = 1;
_redraw->drawInGameTransBox = true;
}
void TwinEEngine::initSVGA() {
_redraw->drawInGameTransBox = 0;
_redraw->drawInGameTransBox = false;
}
void TwinEEngine::initAll() {
@ -382,7 +382,7 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
switch (loopInventoryItem) {
case kiHolomap:
_holomap->processHolomap();
_screens->lockPalette = 1;
_screens->lockPalette = true;
warning("Use inventory [kiHolomap] not implemented!\n");
break;
case kiMagicBall:
@ -420,7 +420,7 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
_screens->clearScreen();
flip();
setPalette(_screens->paletteRGBA);
_screens->lockPalette = 1;
_screens->lockPalette = true;
} break;
case kiProtoPack:
if (_gameState->gameFlags[InventoryItems::kiBookOfBu]) {
@ -529,7 +529,7 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
_grid->newCameraX = _scene->sceneActors[_scene->currentlyFollowedActor].x >> 9;
_grid->newCameraY = _scene->sceneActors[_scene->currentlyFollowedActor].y >> 8;
_grid->newCameraZ = _scene->sceneActors[_scene->currentlyFollowedActor].z >> 9;
_redraw->reqBgRedraw = 1;
_redraw->reqBgRedraw = true;
}
// Draw holomap
@ -537,7 +537,7 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
freezeTime();
//TestRestoreModeSVGA(1);
_holomap->processHolomap();
_screens->lockPalette = 1;
_screens->lockPalette = true;
unfreezeTime();
_redraw->redrawEngineActions(1);
}
@ -676,8 +676,8 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
_scene->heroPositionType = kReborn;
_scene->sceneHero->life = 50;
_redraw->reqBgRedraw = 1;
_screens->lockPalette = 1;
_redraw->reqBgRedraw = true;
_screens->lockPalette = true;
_gameState->inventoryNumLeafs--;
_actor->cropBottomScreen = 0;
} else { // game over
@ -734,7 +734,7 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
_grid->newCameraZ = 63;
}
_redraw->reqBgRedraw = 1;
_redraw->reqBgRedraw = true;
}
}
@ -756,8 +756,8 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
bool TwinEEngine::gameEngineLoop() { // mainLoop
uint32 start;
_redraw->reqBgRedraw = 1;
_screens->lockPalette = 1;
_redraw->reqBgRedraw = true;
_screens->lockPalette = true;
_movements->setActorAngle(0, -256, 5, &loopMovePtr);
while (quitGame == -1) {