[Scummvm-git-logs] scummvm master -> 46723348fcbfb5fe30479551ec5169d2f1dc6bda
mgerhardy
martin.gerhardy at gmail.com
Mon Oct 11 18:32:16 UTC 2021
This automated email contains information about 12 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
55d1d15eba TWINE: removed todo comment
df6f013b0f TWINE: implemented menu demo loop
362111301b TWINE: fixed extra flag names
9b50ab77dd TWINE: track index of -1 means to stop the music
950a4540cd TWINE: replaced magic numbers and named enum constants
b7bd68662e TWINE: fill missing DrawListType values
3c6e9ad2c9 TWINE: renamed variable
f9e6995539 TWINE: prepare compilePolygons to support clipping
10402047b7 TWINE: added missing reset of clipping area
f4461e7424 TWINE: make sure we have a proper clip value set
cae51f4222 TWINE: ensure that the clip is properly reset
46723348fc TWINE: added clipping to model rendering
Commit: 55d1d15ebafb023ec2a955873461c0a10fae771b
https://github.com/scummvm/scummvm/commit/55d1d15ebafb023ec2a955873461c0a10fae771b
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-10-11T20:31:58+02:00
Commit Message:
TWINE: removed todo comment
polygon details are implemented now
Changed paths:
engines/twine/twine.h
diff --git a/engines/twine/twine.h b/engines/twine/twine.h
index 2a7e5a35a5..a3841c358e 100644
--- a/engines/twine/twine.h
+++ b/engines/twine/twine.h
@@ -92,7 +92,7 @@ struct ConfigFile {
bool Debug = false;
/** Type of music file to be used */
MidiFileType MidiType = MIDIFILE_NONE;
- /** *Game version */
+ /** Game version */
int32 Version = EUROPE_VERSION;
/** If you want to use the LBA CD or not */
int32 UseCD = 0;
@@ -115,7 +115,6 @@ struct ConfigFile {
// these settings can be changed in-game - and must be persisted
/** Shadow mode type, value: all, character only, none */
int32 ShadowMode = 0;
- // TODO: currently unused
int32 PolygonDetails = 2;
/** Scenery Zoom */
bool SceZoom = false;
Commit: df6f013b0f1bd4a6de7d048f4ca1a28ee67b1a33
https://github.com/scummvm/scummvm/commit/df6f013b0f1bd4a6de7d048f4ca1a28ee67b1a33
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-10-11T20:31:58+02:00
Commit Message:
TWINE: implemented menu demo loop
Changed paths:
engines/twine/menu/menu.cpp
engines/twine/movies.cpp
engines/twine/movies.h
engines/twine/renderer/screens.h
diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index 2a24e6ad3d..f33db70ed8 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -35,6 +35,7 @@
#include "twine/scene/animations.h"
#include "twine/audio/music.h"
#include "twine/audio/sound.h"
+#include "twine/movies.h"
#include "twine/scene/gamestate.h"
#include "twine/scene/grid.h"
#include "twine/resources/hqr.h"
@@ -591,17 +592,23 @@ int32 Menu::processMenu(MenuSettings *menuSettings, bool showCredits) {
}
if (showCredits && loopMillis - startMillis > 11650) {
_engine->_menuOptions->showCredits();
+ if (_engine->_flaMovies->playFlaMovie(FLA_DRAGON3)) {
+ if (!_engine->_screens->loadImageDelay(TwineImage(Resources::HQR_RESS_FILE, 15, 16), 3)) {
+ if (!_engine->_screens->loadImageDelay(TwineImage(Resources::HQR_RESS_FILE, 17, 18), 3)) {
+ if (!_engine->_screens->loadImageDelay(TwineImage(Resources::HQR_RESS_FILE, 19, 20), 3)) {
+ if (_engine->_flaMovies->playFlaMovie(FLA_BATEAU)) {
+ if (_engine->_cfgfile.Version == USA_VERSION) {
+ _engine->_screens->loadImageDelay(_engine->_resources->relentLogo(), 3);
+ } else {
+ _engine->_screens->loadImageDelay(_engine->_resources->lbaLogo(), 3);
+ }
+ _engine->_screens->adelineLogo();
+ }
+ }
+ }
+ }
+ }
_engine->_text->initTextBank(TextBankId::Options_and_menus);
-
- // TODO the original game also performs these actions:
- // play FLA_DRAGON3 fla
- // display RESSHQR_INTROSCREEN1IMG
- // display RESSHQR_INTROSCREEN2IMG
- // display RESSHQR_INTROSCREEN3IMG
- // play FLA_BATEAU fla
- // if version == EUROPE_VERSION display RESSHQR_LBAIMG else display RESSHQR_RELLENTIMG
- // display adeline logo
- // pressing any key during these actions will abort everything and return to the menu
startMillis = _engine->_system->getMillis();
_engine->_screens->loadMenuImage(false);
}
diff --git a/engines/twine/movies.cpp b/engines/twine/movies.cpp
index ef70aa0664..98c23ca8d5 100644
--- a/engines/twine/movies.cpp
+++ b/engines/twine/movies.cpp
@@ -353,7 +353,7 @@ void Movies::playGIFMovie(const char *flaName) {
}
}
-void Movies::playFlaMovie(const char *flaName) {
+bool Movies::playFlaMovie(const char *flaName) {
assert(_engine->isLBA1());
_engine->_sound->stopSamples();
@@ -365,7 +365,7 @@ void Movies::playFlaMovie(const char *flaName) {
if (_engine->_cfgfile.Movie == CONF_MOVIE_FLAGIF) {
playGIFMovie(fileNamePath.c_str());
- return;
+ return true;
}
_engine->_music->stopMusic();
@@ -377,7 +377,7 @@ void Movies::playFlaMovie(const char *flaName) {
if (!_file.open(fileNamePath + FLA_EXT)) {
warning("Failed to open fla movie '%s'", fileNamePath.c_str());
playGIFMovie(fileNamePath.c_str());
- return;
+ return true;
}
const uint32 version = _file.readUint32LE();
@@ -395,6 +395,7 @@ void Movies::playFlaMovie(const char *flaName) {
_file.skip(4 * _samplesInFla);
+ bool finished = false;
if (version != MKTAG('V', '1', '.', '3')) {
int32 currentFrame = 0;
@@ -410,6 +411,7 @@ void Movies::playFlaMovie(const char *flaName) {
break;
}
if (currentFrame == _flaHeaderData.numOfFrames) {
+ finished = true;
break;
}
processFrame();
@@ -446,6 +448,7 @@ void Movies::playFlaMovie(const char *flaName) {
}
_engine->_sound->stopSamples();
+ return finished;
}
void Movies::playSmkMovie(int index) {
diff --git a/engines/twine/movies.h b/engines/twine/movies.h
index eb409e584d..f02198b856 100644
--- a/engines/twine/movies.h
+++ b/engines/twine/movies.h
@@ -101,8 +101,9 @@ public:
/**
* Play FLA movies
* @param flaName FLA movie name
+ * @return @c true if finished. @c false if aborted.
*/
- void playFlaMovie(const char *flaName);
+ bool playFlaMovie(const char *flaName);
void playSmkMovie(int index);
};
diff --git a/engines/twine/renderer/screens.h b/engines/twine/renderer/screens.h
index afc0eb9350..b2e01526cb 100644
--- a/engines/twine/renderer/screens.h
+++ b/engines/twine/renderer/screens.h
@@ -96,6 +96,7 @@ public:
* @param index \a RESS.HQR entry index (starting from 0)
* @param paletteIndex \a RESS.HQR entry index of the palette for the given image. This is often the @c index + 1
* @param seconds number of seconds to delay
+ * @return @c true if aborted
*/
bool loadImageDelay(TwineImage image, int32 seconds);
Commit: 362111301bb757def3abb6a643901f1173e41aa1
https://github.com/scummvm/scummvm/commit/362111301bb757def3abb6a643901f1173e41aa1
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-10-11T20:31:58+02:00
Commit Message:
TWINE: fixed extra flag names
Changed paths:
engines/twine/scene/extra.cpp
engines/twine/scene/extra.h
diff --git a/engines/twine/scene/extra.cpp b/engines/twine/scene/extra.cpp
index 1b1019f75a..3bbe0a139a 100644
--- a/engines/twine/scene/extra.cpp
+++ b/engines/twine/scene/extra.cpp
@@ -85,7 +85,7 @@ int32 Extra::addExtra(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx
continue;
}
extra->info0 = spriteIdx;
- extra->type = ExtraType::UNK7;
+ extra->type = ExtraType::SEARCH_OBJ;
extra->info1 = 0;
extra->pos.x = x;
extra->pos.y = y;
@@ -161,7 +161,7 @@ int32 Extra::addExtraSpecial(int32 x, int32 y, int32 z, ExtraSpecialType type) {
extra->info1 = 0;
if (type == ExtraSpecialType::kHitStars) {
- extra->type = ExtraType::TIME_OUT | ExtraType::UNK3;
+ extra->type = ExtraType::TIME_OUT | ExtraType::END_COL;
extra->pos.x = x;
extra->pos.y = y;
@@ -229,10 +229,10 @@ int32 Extra::addExtraBonus(int32 x, int32 y, int32 z, int32 xAngle, int32 yAngle
continue;
}
extra->info0 = type;
- extra->type = ExtraType::STOP_COL | ExtraType::TAKABLE | ExtraType::BONUS;
+ extra->type = ExtraType::STOP_COL | ExtraType::TAKABLE | ExtraType::WAIT_SOME_TIME;
if (type != SPRITEHQR_KEY) {
- extra->type = ExtraType::TIME_OUT | ExtraType::TAKABLE | ExtraType::FLASH | ExtraType::STOP_COL | ExtraType::BONUS;
+ extra->type = ExtraType::TIME_OUT | ExtraType::TAKABLE | ExtraType::FLASH | ExtraType::STOP_COL | ExtraType::WAIT_SOME_TIME;
}
extra->pos.x = x;
@@ -257,7 +257,7 @@ int32 Extra::addExtraThrow(int32 actorIdx, int32 x, int32 y, int32 z, int32 spri
continue;
}
extra->info0 = spriteIdx;
- extra->type = ExtraType::UNK2 | ExtraType::UNK3 | ExtraType::UNK8 | ExtraType::WAIT_NO_COL;
+ extra->type = ExtraType::END_OBJ | ExtraType::END_COL | ExtraType::IMPACT | ExtraType::WAIT_NO_COL;
extra->pos.x = x;
extra->pos.y = y;
extra->pos.z = z;
@@ -282,7 +282,7 @@ int32 Extra::addExtraAiming(int32 actorIdx, int32 x, int32 y, int32 z, int32 spr
continue;
}
extra->info0 = spriteIdx;
- extra->type = ExtraType::UNK7;
+ extra->type = ExtraType::SEARCH_OBJ;
extra->info1 = 0;
extra->pos.x = x;
extra->pos.y = y;
@@ -538,7 +538,7 @@ void Extra::processExtras() {
}
}
// reset extra
- if (extra->type & ExtraType::RESET_EXTRA) {
+ if (extra->type & ExtraType::ONE_FRAME) {
extra->info0 = -1;
continue;
}
@@ -589,14 +589,14 @@ void Extra::processExtras() {
}
}
- if (extra->type & ExtraType::BONUS) {
+ if (extra->type & ExtraType::WAIT_SOME_TIME) {
if (_engine->_lbaTime - extra->spawnTime > 40) {
- extra->type &= ~ExtraType::BONUS;
+ extra->type &= ~ExtraType::WAIT_SOME_TIME;
}
continue;
}
// process actor target hit
- if (extra->type & ExtraType::UNK7) {
+ if (extra->type & ExtraType::SEARCH_OBJ) {
int32 actorIdxAttacked = extra->spawnTime;
int32 actorIdx = extra->payload.actorIdx;
@@ -719,7 +719,7 @@ void Extra::processExtras() {
}
}
// process extra collision with actors
- if (extra->type & ExtraType::UNK2) {
+ if (extra->type & ExtraType::END_OBJ) {
if (_engine->_collision->checkExtraCollisionWithActors(extra, extra->payload.actorIdx) != -1) {
// if extra is Magic Ball
if (i == _engine->_gameState->_magicBallIdx) {
@@ -740,7 +740,7 @@ void Extra::processExtras() {
}
}
// process extra collision with scene ground
- if (extra->type & ExtraType::UNK3) {
+ if (extra->type & ExtraType::END_COL) {
bool process = false;
if (_engine->_collision->checkExtraCollisionWithBricks(currentExtraX, currentExtraY, currentExtraZ, extra->pos)) {
@@ -757,7 +757,7 @@ void Extra::processExtras() {
if (process) {
// show explode cloud
- if (extra->type & ExtraType::UNK8) {
+ if (extra->type & ExtraType::IMPACT) {
addExtraSpecial(currentExtraX, currentExtraY, currentExtraZ, ExtraSpecialType::kExplodeCloud);
}
// if extra is magic ball
diff --git a/engines/twine/scene/extra.h b/engines/twine/scene/extra.h
index 960b5a5be6..72cb1a61d3 100644
--- a/engines/twine/scene/extra.h
+++ b/engines/twine/scene/extra.h
@@ -44,22 +44,22 @@ struct ExtraShape {
};
enum ExtraType {
- TIME_OUT = 1 << 0, // 0x0001
- FLY = 1 << 1, // 0x0002
- UNK2 = 1 << 2, // 0x0004
- UNK3 = 1 << 3, // 0x0008
- STOP_COL = 1 << 4, // 0x0010
- TAKABLE = 1 << 5, // 0x0020
- FLASH = 1 << 6, // 0x0040
- UNK7 = 1 << 7, // 0x0080
- UNK8 = 1 << 8, // 0x0100
- MAGIC_BALL_KEY = 1 << 9, // 0x0200
- TIME_IN = 1 << 10, // 0x0400
- RESET_EXTRA = 1 << 11, // 0x0800
- EXPLOSION = 1 << 12, // 0x1000
- WAIT_NO_COL = 1 << 13, // 0x2000
- BONUS = 1 << 14, // 0x4000
- UNK15 = 1 << 15 // 0x8000
+ TIME_OUT = 1 << 0, // 0x0001
+ FLY = 1 << 1, // 0x0002
+ END_OBJ = 1 << 2, // 0x0004
+ END_COL = 1 << 3, // 0x0008
+ STOP_COL = 1 << 4, // 0x0010
+ TAKABLE = 1 << 5, // 0x0020
+ FLASH = 1 << 6, // 0x0040
+ SEARCH_OBJ = 1 << 7, // 0x0080
+ IMPACT = 1 << 8, // 0x0100
+ MAGIC_BALL_KEY = 1 << 9, // 0x0200
+ TIME_IN = 1 << 10, // 0x0400
+ ONE_FRAME = 1 << 11, // 0x0800
+ EXPLOSION = 1 << 12, // 0x1000
+ WAIT_NO_COL = 1 << 13, // 0x2000
+ WAIT_SOME_TIME = 1 << 14, // 0x4000
+ COMPUTE_TRAJ = 1 << 15 // 0x8000 used in dotemu enhanced to render the magic ball trajectories
};
struct ExtraListStruct {
Commit: 9b50ab77ddaf7a5fcf073ea0dba1a5b241f70630
https://github.com/scummvm/scummvm/commit/9b50ab77ddaf7a5fcf073ea0dba1a5b241f70630
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-10-11T20:31:58+02:00
Commit Message:
TWINE: track index of -1 means to stop the music
Changed paths:
engines/twine/audio/music.cpp
diff --git a/engines/twine/audio/music.cpp b/engines/twine/audio/music.cpp
index 5dcd71bf9f..7e6373cf5f 100644
--- a/engines/twine/audio/music.cpp
+++ b/engines/twine/audio/music.cpp
@@ -137,6 +137,10 @@ void Music::stopTrackMusicCd() {
}
bool Music::playTrackMusic(int32 track) {
+ if (track == -1) {
+ stopMusic();
+ return true;
+ }
if (!_engine->_cfgfile.Sound) {
return false;
}
Commit: 950a4540cd9b4cf83611ccfe8fb0f09922c35ad6
https://github.com/scummvm/scummvm/commit/950a4540cd9b4cf83611ccfe8fb0f09922c35ad6
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-10-11T20:31:58+02:00
Commit Message:
TWINE: replaced magic numbers and named enum constants
Changed paths:
engines/twine/scene/actor.cpp
engines/twine/scene/animations.cpp
engines/twine/scene/collision.cpp
engines/twine/scene/grid.h
engines/twine/scene/movements.cpp
engines/twine/scene/scene.cpp
engines/twine/script/script_life_v1.cpp
engines/twine/shared.h
engines/twine/twine.cpp
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index 172fc4439a..aecae0cbcd 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -129,7 +129,7 @@ void Actor::setBehaviour(HeroBehaviourType behaviour) {
sceneHero->_anim = AnimationTypes::kAnimNone;
sceneHero->_animType = AnimType::kAnimationTypeLoop;
- _engine->_animations->initAnim(AnimationTypes::kStanding, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, 0);
+ _engine->_animations->initAnim(AnimationTypes::kStanding, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, OWN_ACTOR_SCENE_INDEX);
}
void Actor::initSpriteActor(int32 actorIdx) {
@@ -329,9 +329,9 @@ void Actor::hitActor(int32 actorIdx, int32 actorIdxAttacked, int32 strengthOfHit
}
if (_engine->getRandomNumber() & 1) {
- _engine->_animations->initAnim(AnimationTypes::kHit2, AnimType::kAnimationType_3, AnimationTypes::kAnimInvalid, actorIdxAttacked);
+ _engine->_animations->initAnim(AnimationTypes::kHit2, AnimType::kAnimationInsert, AnimationTypes::kAnimInvalid, actorIdxAttacked);
} else {
- _engine->_animations->initAnim(AnimationTypes::kBigHit, AnimType::kAnimationType_3, AnimationTypes::kAnimInvalid, actorIdxAttacked);
+ _engine->_animations->initAnim(AnimationTypes::kBigHit, AnimType::kAnimationInsert, AnimationTypes::kAnimInvalid, actorIdxAttacked);
}
}
@@ -346,7 +346,7 @@ void Actor::hitActor(int32 actorIdx, int32 actorIdxAttacked, int32 strengthOfHit
actor->_life = 0;
}
} else {
- _engine->_animations->initAnim(AnimationTypes::kHit, AnimType::kAnimationType_3, AnimationTypes::kAnimInvalid, actorIdxAttacked);
+ _engine->_animations->initAnim(AnimationTypes::kHit, AnimType::kAnimationInsert, AnimationTypes::kAnimInvalid, actorIdxAttacked);
}
}
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index bce4fd5c45..30f3e6a4ed 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -402,7 +402,7 @@ bool Animations::initAnim(AnimationTypes newAnim, AnimType animType, AnimationTy
return true;
}
- if (animExtra == AnimationTypes::kAnimInvalid && actor->_animType != AnimType::kAnimationType_2) {
+ if (animExtra == AnimationTypes::kAnimInvalid && actor->_animType != AnimType::kAnimationAllThen) {
animExtra = actor->_anim;
}
@@ -412,13 +412,13 @@ bool Animations::initAnim(AnimationTypes newAnim, AnimType animType, AnimationTy
animIndex = getBodyAnimIndex(AnimationTypes::kStanding, actorIdx);
}
- if (animType != AnimType::kAnimationType_4 && actor->_animType == AnimType::kAnimationType_2) {
+ if (animType != AnimType::kAnimationSet && actor->_animType == AnimType::kAnimationAllThen) {
actor->_animExtra = newAnim;
return false;
}
- if (animType == AnimType::kAnimationType_3) {
- animType = AnimType::kAnimationType_2;
+ if (animType == AnimType::kAnimationInsert) {
+ animType = AnimType::kAnimationAllThen;
animExtra = actor->_anim;
@@ -427,8 +427,8 @@ bool Animations::initAnim(AnimationTypes newAnim, AnimType animType, AnimationTy
}
}
- if (animType == AnimType::kAnimationType_4) {
- animType = AnimType::kAnimationType_2;
+ if (animType == AnimType::kAnimationSet) {
+ animType = AnimType::kAnimationAllThen;
}
if (actor->_previousAnimIdx == -1) {
@@ -695,7 +695,7 @@ void Animations::processActorAnimations(int32 actorIdx) {
if (destPos.x >= 0 && destPos.z >= 0 && destPos.x <= 0x7E00 && destPos.z <= 0x7E00) { // SCENE_SIZE_MAX
if (_engine->_grid->getBrickShape(destPos.x, processActor.y + BRICK_HEIGHT, destPos.z) != ShapeType::kNone && _engine->_cfgfile.WallCollision) { // avoid wall hit damage
_engine->_extra->addExtraSpecial(actor->_pos.x, actor->_pos.y + 1000, actor->_pos.z, ExtraSpecialType::kHitStars);
- initAnim(AnimationTypes::kBigHit, AnimType::kAnimationType_2, AnimationTypes::kStanding, _currentlyProcessedActorIdx);
+ initAnim(AnimationTypes::kBigHit, AnimType::kAnimationAllThen, AnimationTypes::kStanding, _currentlyProcessedActorIdx);
if (IS_HERO(_currentlyProcessedActorIdx)) {
_engine->_movements->_heroMoved = true;
@@ -717,7 +717,7 @@ void Animations::processActorAnimations(int32 actorIdx) {
} else {
if (IS_HERO(actorIdx) && _engine->_actor->_heroBehaviour == HeroBehaviourType::kAthletic && actor->_anim == AnimationTypes::kForward && _engine->_cfgfile.WallCollision) { // avoid wall hit damage
_engine->_extra->addExtraSpecial(actor->_pos.x, actor->_pos.y + 1000, actor->_pos.z, ExtraSpecialType::kHitStars);
- initAnim(AnimationTypes::kBigHit, AnimType::kAnimationType_2, AnimationTypes::kStanding, _currentlyProcessedActorIdx);
+ initAnim(AnimationTypes::kBigHit, AnimType::kAnimationAllThen, AnimationTypes::kStanding, _currentlyProcessedActorIdx);
_engine->_movements->_heroMoved = true;
actor->addLife(-1);
}
diff --git a/engines/twine/scene/collision.cpp b/engines/twine/scene/collision.cpp
index 9ec6e61c72..714c7e4a53 100644
--- a/engines/twine/scene/collision.cpp
+++ b/engines/twine/scene/collision.cpp
@@ -383,16 +383,16 @@ void Collision::stopFalling() { // ReceptionObj()
} else {
_engine->_actor->_processActorPtr->addLife(-1);
}
- _engine->_animations->initAnim(AnimationTypes::kLandingHit, AnimType::kAnimationType_2, AnimationTypes::kStanding, _engine->_animations->_currentlyProcessedActorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kLandingHit, AnimType::kAnimationAllThen, AnimationTypes::kStanding, _engine->_animations->_currentlyProcessedActorIdx);
} else if (fall > 10) {
- _engine->_animations->initAnim(AnimationTypes::kLanding, AnimType::kAnimationType_2, AnimationTypes::kStanding, _engine->_animations->_currentlyProcessedActorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kLanding, AnimType::kAnimationAllThen, AnimationTypes::kStanding, _engine->_animations->_currentlyProcessedActorIdx);
} else {
_engine->_animations->initAnim(AnimationTypes::kStanding, AnimType::kAnimationTypeLoop, AnimationTypes::kStanding, _engine->_animations->_currentlyProcessedActorIdx);
}
_engine->_scene->_heroYBeforeFall = 0;
} else {
- _engine->_animations->initAnim(AnimationTypes::kLanding, AnimType::kAnimationType_2, _engine->_actor->_processActorPtr->_animExtra, _engine->_animations->_currentlyProcessedActorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kLanding, AnimType::kAnimationAllThen, _engine->_actor->_processActorPtr->_animExtra, _engine->_animations->_currentlyProcessedActorIdx);
}
_engine->_actor->_processActorPtr->_dynamicFlags.bIsFalling = 0;
diff --git a/engines/twine/scene/grid.h b/engines/twine/scene/grid.h
index c5a54a6760..014fcabe68 100644
--- a/engines/twine/scene/grid.h
+++ b/engines/twine/scene/grid.h
@@ -23,6 +23,8 @@
#ifndef TWINE_SCENE_GRID_H
#define TWINE_SCENE_GRID_H
+#define WATER_BRICK (0xF1)
+
#include "common/scummsys.h"
#include "twine/parser/blocklibrary.h"
#include "twine/parser/sprite.h"
diff --git a/engines/twine/scene/movements.cpp b/engines/twine/scene/movements.cpp
index 1f8739621c..d740f48927 100644
--- a/engines/twine/scene/movements.cpp
+++ b/engines/twine/scene/movements.cpp
@@ -218,7 +218,7 @@ bool Movements::processBehaviourExecution(int actorIdx) {
executeAction = true;
break;
case HeroBehaviourType::kAthletic:
- _engine->_animations->initAnim(AnimationTypes::kJump, AnimType::kAnimationType_1, AnimationTypes::kStanding, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kJump, AnimType::kAnimationThen, AnimationTypes::kStanding, actorIdx);
break;
case HeroBehaviourType::kAggressive:
if (_engine->_actor->_autoAggressive) {
@@ -231,25 +231,25 @@ bool Movements::processBehaviourExecution(int actorIdx) {
switch (aggresiveMode) {
case 0:
- _engine->_animations->initAnim(AnimationTypes::kKick, AnimType::kAnimationType_1, AnimationTypes::kStanding, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kKick, AnimType::kAnimationThen, AnimationTypes::kStanding, actorIdx);
break;
case 1:
- _engine->_animations->initAnim(AnimationTypes::kRightPunch, AnimType::kAnimationType_1, AnimationTypes::kStanding, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kRightPunch, AnimType::kAnimationThen, AnimationTypes::kStanding, actorIdx);
break;
case 2:
- _engine->_animations->initAnim(AnimationTypes::kLeftPunch, AnimType::kAnimationType_1, AnimationTypes::kStanding, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kLeftPunch, AnimType::kAnimationThen, AnimationTypes::kStanding, actorIdx);
break;
}
}
} else {
if (_engine->_input->isActionActive(TwinEActionType::TurnLeft)) {
- _engine->_animations->initAnim(AnimationTypes::kLeftPunch, AnimType::kAnimationType_1, AnimationTypes::kStanding, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kLeftPunch, AnimType::kAnimationThen, AnimationTypes::kStanding, actorIdx);
_heroMoved = true;
} else if (_engine->_input->isActionActive(TwinEActionType::TurnRight)) {
- _engine->_animations->initAnim(AnimationTypes::kRightPunch, AnimType::kAnimationType_1, AnimationTypes::kStanding, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kRightPunch, AnimType::kAnimationThen, AnimationTypes::kStanding, actorIdx);
_heroMoved = true;
} else if (_engine->_input->isActionActive(TwinEActionType::MoveForward)) {
- _engine->_animations->initAnim(AnimationTypes::kKick, AnimType::kAnimationType_1, AnimationTypes::kStanding, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kKick, AnimType::kAnimationThen, AnimationTypes::kStanding, actorIdx);
_heroMoved = true;
}
}
@@ -269,7 +269,7 @@ bool Movements::processAttackExecution(int actorIdx) {
// Use Magic Ball
if (_engine->_gameState->hasItem(InventoryItems::kiMagicBall)) {
if (_engine->_gameState->_magicBallIdx == -1) {
- _engine->_animations->initAnim(AnimationTypes::kThrowBall, AnimType::kAnimationType_1, AnimationTypes::kStanding, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kThrowBall, AnimType::kAnimationThen, AnimationTypes::kStanding, actorIdx);
}
actor->_angle = actor->_move.getRealAngle(_engine->_lbaTime);
@@ -280,7 +280,7 @@ bool Movements::processAttackExecution(int actorIdx) {
_engine->_actor->initModelActor(BodyType::btSabre, actorIdx);
}
- _engine->_animations->initAnim(AnimationTypes::kSabreAttack, AnimType::kAnimationType_1, AnimationTypes::kStanding, actorIdx);
+ _engine->_animations->initAnim(AnimationTypes::kSabreAttack, AnimType::kAnimationThen, AnimationTypes::kStanding, actorIdx);
actor->_angle = actor->_move.getRealAngle(_engine->_lbaTime);
return true;
diff --git a/engines/twine/scene/scene.cpp b/engines/twine/scene/scene.cpp
index ab777ff874..4bd28e9d68 100644
--- a/engines/twine/scene/scene.cpp
+++ b/engines/twine/scene/scene.cpp
@@ -733,7 +733,7 @@ void Scene::processActorZones(int32 actorIdx) {
break;
case ZoneType::kObject:
if (IS_HERO(actorIdx) && _engine->_movements->shouldTriggerZoneAction()) {
- _engine->_animations->initAnim(AnimationTypes::kAction, AnimType::kAnimationType_1, AnimationTypes::kStanding, 0);
+ _engine->_animations->initAnim(AnimationTypes::kAction, AnimType::kAnimationThen, AnimationTypes::kStanding, OWN_ACTOR_SCENE_INDEX);
processZoneExtraBonus(zone);
}
break;
@@ -757,7 +757,7 @@ void Scene::processActorZones(int32 actorIdx) {
if (_engine->_grid->getBrickShape(destPos.x, actor->_pos.y + ANGLE_90, destPos.z) != ShapeType::kNone) {
_currentActorInZone = true;
if (actor->_pos.y >= ABS(zone->mins.y + zone->maxs.y) / 2) {
- _engine->_animations->initAnim(AnimationTypes::kTopLadder, AnimType::kAnimationType_2, AnimationTypes::kStanding, actorIdx); // reached end of ladder
+ _engine->_animations->initAnim(AnimationTypes::kTopLadder, AnimType::kAnimationAllThen, AnimationTypes::kStanding, actorIdx); // reached end of ladder
} else {
_engine->_animations->initAnim(AnimationTypes::kClimbLadder, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, actorIdx); // go up in ladder
}
diff --git a/engines/twine/script/script_life_v1.cpp b/engines/twine/script/script_life_v1.cpp
index 6e82d1920c..1b50c73d42 100644
--- a/engines/twine/script/script_life_v1.cpp
+++ b/engines/twine/script/script_life_v1.cpp
@@ -733,7 +733,7 @@ static int32 lCAM_FOLLOW(TwinEEngine *engine, LifeScriptContext &ctx) {
static int32 lSET_BEHAVIOUR(TwinEEngine *engine, LifeScriptContext &ctx) {
const HeroBehaviourType behavior = (HeroBehaviourType)ctx.stream.readByte();
- engine->_animations->initAnim(AnimationTypes::kStanding, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, 0);
+ engine->_animations->initAnim(AnimationTypes::kStanding, AnimType::kAnimationTypeLoop, AnimationTypes::kAnimInvalid, OWN_ACTOR_SCENE_INDEX);
engine->_actor->setBehaviour(behavior);
return 0;
diff --git a/engines/twine/shared.h b/engines/twine/shared.h
index 4fb34c434f..da2eb9b8ab 100644
--- a/engines/twine/shared.h
+++ b/engines/twine/shared.h
@@ -262,15 +262,15 @@ enum class AnimationTypes {
enum class AnimType {
kAnimationTypeLoop = 0,
- kAnimationType_1 = 1,
+ kAnimationThen = 1,
// play animation and let animExtra follow as next animation
// if there is already a next animation set - replace the value
- kAnimationType_2 = 2,
+ kAnimationAllThen = 2,
// replace animation and let the current animation follow
- kAnimationType_3 = 3,
+ kAnimationInsert = 3,
// play animation and let animExtra follow as next animation
// but don't take the current state in account
- kAnimationType_4 = 4
+ kAnimationSet = 4
};
/** Hero behaviour
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 1d97acb503..7fde7de197 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -633,7 +633,7 @@ void TwinEEngine::processInventoryAction() {
_actor->setBehaviour(HeroBehaviourType::kNormal);
}
_actor->initModelActor(BodyType::btSabre, OWN_ACTOR_SCENE_INDEX);
- _animations->initAnim(AnimationTypes::kSabreUnknown, AnimType::kAnimationType_1, AnimationTypes::kStanding, OWN_ACTOR_SCENE_INDEX);
+ _animations->initAnim(AnimationTypes::kSabreUnknown, AnimType::kAnimationThen, AnimationTypes::kStanding, OWN_ACTOR_SCENE_INDEX);
_gameState->_usingSabre = true;
}
@@ -875,7 +875,7 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
if (actor->_life == 0) {
if (IS_HERO(a)) {
- _animations->initAnim(AnimationTypes::kLandDeath, AnimType::kAnimationType_4, AnimationTypes::kStanding, 0);
+ _animations->initAnim(AnimationTypes::kLandDeath, AnimType::kAnimationSet, AnimationTypes::kStanding, OWN_ACTOR_SCENE_INDEX);
actor->_controlMode = ControlMode::kNoMove;
} else {
_sound->playSample(Samples::Explode, 1, actor->pos(), a);
@@ -918,12 +918,12 @@ int32 TwinEEngine::runGameEngine() { // mainLoopInteration
const uint8 brickSound = _grid->getBrickSoundType(actor->_pos.x, actor->_pos.y - 1, actor->_pos.z);
actor->_brickSound = brickSound;
- if (brickSound == 0xF1U) {
+ if (brickSound == WATER_BRICK) {
if (IS_HERO(a)) {
// we are dying if we aren't using the protopack to fly over water
if (_actor->_heroBehaviour != HeroBehaviourType::kProtoPack || actor->_anim != AnimationTypes::kForward) {
if (!_actor->_cropBottomScreen) {
- _animations->initAnim(AnimationTypes::kDrawn, AnimType::kAnimationType_4, AnimationTypes::kStanding, 0);
+ _animations->initAnim(AnimationTypes::kDrawn, AnimType::kAnimationSet, AnimationTypes::kStanding, OWN_ACTOR_SCENE_INDEX);
}
const IVec3 &projPos = _renderer->projectPositionOnScreen(actor->pos() - _grid->_camera);
actor->_controlMode = ControlMode::kNoMove;
Commit: b7bd68662e01eb4cc69671ece31279e88f0fa498
https://github.com/scummvm/scummvm/commit/b7bd68662e01eb4cc69671ece31279e88f0fa498
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-10-11T20:31:58+02:00
Commit Message:
TWINE: fill missing DrawListType values
Changed paths:
engines/twine/renderer/redraw.cpp
engines/twine/renderer/redraw.h
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index 8e87a05cfe..f331496dbb 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -348,6 +348,13 @@ void Redraw::processDrawListActors(const DrawListStruct &drawCmd, bool bgRedraw)
const IVec3 &delta = actor->pos() - _engine->_grid->_camera;
Common::Rect renderRect;
+
+ if (actorIdx == OWN_ACTOR_SCENE_INDEX) {
+ if (_engine->_actor->_cropBottomScreen) {
+ _engine->_interface->_clip.bottom = _engine->_actor->_cropBottomScreen;
+ }
+ }
+
if (!_engine->_renderer->renderIsoModel(delta.x, delta.y, delta.z, ANGLE_0, actor->_angle, ANGLE_0, _engine->_resources->_bodyData[actor->_entity], renderRect)) {
return;
}
@@ -364,10 +371,6 @@ void Redraw::processDrawListActors(const DrawListStruct &drawCmd, bool bgRedraw)
_engine->_grid->drawOverModelActor(tempX, tempY, tempZ);
- if (_engine->_actor->_cropBottomScreen) {
- _engine->_interface->_clip.bottom = _engine->_actor->_cropBottomScreen + 10;
- }
-
addRedrawArea(_engine->_interface->_clip);
if (actor->_staticFlags.bIsBackgrounded && bgRedraw) {
@@ -480,27 +483,13 @@ void Redraw::processDrawList(DrawListStruct *drawList, int32 drawListPos, bool b
for (int32 pos = 0; pos < drawListPos; ++pos) {
const DrawListStruct &drawCmd = drawList[pos];
const uint32 flags = drawCmd.type;
- // Drawing actors
- if (flags < DrawListType::DrawShadows) {
- if (flags == 0) {
- processDrawListActors(drawCmd, bgRedraw);
- }
- }
- // Drawing shadows
- else if (flags == DrawListType::DrawShadows && !_engine->_actor->_cropBottomScreen) {
+ if (flags == DrawListType::DrawObject3D) {
+ processDrawListActors(drawCmd, bgRedraw);
+ } else if (flags == DrawListType::DrawShadows && !_engine->_actor->_cropBottomScreen) {
processDrawListShadows(drawCmd);
- }
- // Drawing unknown
- else if (flags < DrawListType::DrawActorSprites) {
- // TODO reverse this part of the code
- warning("Not yet reversed part of the rendering code: %u", flags);
- }
- // Drawing sprite actors, doors and entities
- else if (flags == DrawListType::DrawActorSprites) {
+ } else if (flags == DrawListType::DrawActorSprites) {
processDrawListActorSprites(drawCmd, bgRedraw);
- }
- // Drawing extras
- else if (flags == DrawListType::DrawExtras) {
+ } else if (flags == DrawListType::DrawExtras) {
processDrawListExtras(drawCmd);
}
diff --git a/engines/twine/renderer/redraw.h b/engines/twine/renderer/redraw.h
index 1ca7a43a7d..e34397d5c6 100644
--- a/engines/twine/renderer/redraw.h
+++ b/engines/twine/renderer/redraw.h
@@ -80,14 +80,23 @@ struct DrawListStruct {
}
};
+#define TYPE_OBJ_SHIFT (10)
+#define TYPE_OBJ_FIRST (1 << TYPE_OBJ_SHIFT) // 1024
+#define NUM_OBJ_MASK (TYPE_OBJ_FIRST - 1)
+
class TwinEEngine;
class Redraw {
private:
TwinEEngine *_engine;
enum DrawListType {
- DrawActorSprites = 0x1000,
- DrawExtras = 0x1800,
- DrawShadows = 0xC00
+ DrawObject3D = (0 << TYPE_OBJ_SHIFT),
+ DrawFlagRed = (1 << TYPE_OBJ_SHIFT),
+ DrawFlagYellow = (2 << TYPE_OBJ_SHIFT),
+ DrawShadows = (3 << TYPE_OBJ_SHIFT),
+ DrawActorSprites = (4 << TYPE_OBJ_SHIFT),
+ DrawZoneDec = (5 << TYPE_OBJ_SHIFT),
+ DrawExtras = (6 << TYPE_OBJ_SHIFT),
+ DrawPrimitive = (7 << TYPE_OBJ_SHIFT)
};
Common::Rect _currentRedrawList[300];
Commit: 3c6e9ad2c92df9ca0a38194c6adf479da7b8a407
https://github.com/scummvm/scummvm/commit/3c6e9ad2c92df9ca0a38194c6adf479da7b8a407
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-10-11T20:31:58+02:00
Commit Message:
TWINE: renamed variable
Changed paths:
engines/twine/renderer/renderer.cpp
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index fcb11c5bee..89f1175df6 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -389,8 +389,8 @@ void Renderer::computePolygons(int16 polyRenderType, const Vertex *vertices, int
int16 currentVertexY = vertices[numVertices - 1].y;
const int16 *polyTabBegin = _polyTab;
const int16 *polyTabEnd = &_polyTab[_polyTabSize - 1];
- const int16 *polyTab2Begin = _colorProgressionBuffer;
- const int16 *polyTab2End = &_colorProgressionBuffer[_polyTabSize - 1];
+ const int16 *colProgressBufStart = _colorProgressionBuffer;
+ const int16 *colProgressBufEnd = &_colorProgressionBuffer[_polyTabSize - 1];
const int screenHeight = _engine->height();
for (int32 nVertex = 0; nVertex < numVertices; nVertex++) {
@@ -449,7 +449,7 @@ void Renderer::computePolygons(int16 polyRenderType, const Vertex *vertices, int
int16 *outPtr2 = &_colorProgressionBuffer[polyTabIndex];
for (int16 i = 0; i < vsize + 2; i++) {
- if (outPtr2 >= polyTab2Begin && outPtr2 <= polyTab2End) {
+ if (outPtr2 >= colProgressBufStart && outPtr2 <= colProgressBufEnd) {
*outPtr2 = cvalue;
}
outPtr2 += direction;
Commit: f9e6995539d4cf30f4fadf728828c3f7800bd241
https://github.com/scummvm/scummvm/commit/f9e6995539d4cf30f4fadf728828c3f7800bd241
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-10-11T20:31:58+02:00
Commit Message:
TWINE: prepare compilePolygons to support clipping
Changed paths:
engines/twine/renderer/renderer.cpp
engines/twine/renderer/renderer.h
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 89f1175df6..ba0f9058c6 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -383,7 +383,7 @@ static FORCEINLINE int16 clamp(int16 x, int16 a, int16 b) {
return x < a ? a : (x > b ? b : x);
}
-void Renderer::computePolygons(int16 polyRenderType, const Vertex *vertices, int32 numVertices) {
+bool Renderer::computePolygons(int16 polyRenderType, const Vertex *vertices, int32 numVertices) {
uint8 vertexParam1 = vertices[numVertices - 1].colorIndex;
int16 currentVertexX = vertices[numVertices - 1].x;
int16 currentVertexY = vertices[numVertices - 1].y;
@@ -457,6 +457,7 @@ void Renderer::computePolygons(int16 polyRenderType, const Vertex *vertices, int
}
}
}
+ return true;
}
void Renderer::renderPolygonsCopper(int vtop, int32 vsize, uint16 color) const {
@@ -954,10 +955,10 @@ void Renderer::renderPolygonsSimplified(int vtop, int32 vsize, uint16 color) con
}
void Renderer::renderPolygons(const CmdRenderPolygon &polygon, Vertex *vertices, int vtop, int vbottom) {
- computePolygons(polygon.renderType, vertices, polygon.numVertices);
-
- const int32 vsize = vbottom - vtop + 1;
- fillVertices(vtop, vsize, polygon.renderType, polygon.colorIndex);
+ if (computePolygons(polygon.renderType, vertices, polygon.numVertices)) {
+ const int32 vsize = vbottom - vtop + 1;
+ fillVertices(vtop, vsize, polygon.renderType, polygon.colorIndex);
+ }
}
void Renderer::fillVertices(int vtop, int32 vsize, uint8 renderType, uint16 color) {
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index ac19d0bfed..7760d3a007 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -194,7 +194,7 @@ private:
void renderPolygonsDither(int vtop, int32 vsize) const;
void renderPolygonsMarble(int vtop, int32 vsize, uint16 color) const;
void renderPolygonsSimplified(int vtop, int32 vsize, uint16 color) const;
- void computePolygons(int16 polyRenderType, const Vertex *vertices, int32 numVertices);
+ bool computePolygons(int16 polyRenderType, const Vertex *vertices, int32 numVertices);
const RenderCommand *depthSortRenderCommands(int32 numOfPrimitives);
uint8 *preparePolygons(const Common::Array<BodyPolygon>& polygons, int32 &numOfPrimitives, RenderCommand **renderCmds, uint8 *renderBufferPtr, ModelData *modelData);
Commit: 10402047b7ef2b4c66b3c794d13d22826f287e61
https://github.com/scummvm/scummvm/commit/10402047b7ef2b4c66b3c794d13d22826f287e61
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-10-11T20:31:58+02:00
Commit Message:
TWINE: added missing reset of clipping area
Changed paths:
engines/twine/renderer/redraw.cpp
engines/twine/renderer/renderer.cpp
engines/twine/scene/gamestate.cpp
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index f331496dbb..d1b443605a 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -336,6 +336,7 @@ void Redraw::processDrawListShadows(const DrawListStruct &drawCmd) {
addRedrawArea(_engine->_interface->_clip);
_engine->_debugScene->drawClip(renderRect);
+ _engine->_interface->resetClip();
}
void Redraw::processDrawListActors(const DrawListStruct &drawCmd, bool bgRedraw) {
@@ -378,6 +379,7 @@ void Redraw::processDrawListActors(const DrawListStruct &drawCmd, bool bgRedraw)
}
_engine->_debugScene->drawClip(_engine->_interface->_clip);
+ _engine->_interface->resetClip();
}
}
@@ -402,14 +404,15 @@ void Redraw::processDrawListActorSprites(const DrawListStruct &drawCmd, bool bgR
renderRect.right = renderRect.left + spriteWidth;
renderRect.bottom = renderRect.top + spriteHeight;
+ bool validClip;
if (actor->_staticFlags.bUsesClipping) {
const Common::Rect rect(_projPosScreen.x + actor->_cropLeft, _projPosScreen.y + actor->_cropTop, _projPosScreen.x + actor->_cropRight, _projPosScreen.y + actor->_cropBottom);
- _engine->_interface->setClip(rect);
+ validClip = _engine->_interface->setClip(rect);
} else {
- _engine->_interface->setClip(renderRect);
+ validClip = _engine->_interface->setClip(renderRect);
}
- if (_engine->_interface->_clip.isValidRect()) {
+ if (validClip) {
_engine->_grid->drawSprite(0, renderRect.left, renderRect.top, spritePtr);
actor->_dynamicFlags.bIsVisible = 1;
@@ -437,6 +440,7 @@ void Redraw::processDrawListActorSprites(const DrawListStruct &drawCmd, bool bgR
}
_engine->_debugScene->drawClip(renderRect);
+ _engine->_interface->resetClip();
}
}
@@ -464,9 +468,7 @@ void Redraw::processDrawListExtras(const DrawListStruct &drawCmd) {
_engine->_grid->drawSprite(renderRect.left, renderRect.top, spritePtr);
}
- _engine->_interface->setClip(renderRect);
-
- if (_engine->_interface->_clip.isValidRect()) {
+ if (_engine->_interface->setClip(renderRect)) {
const int32 tmpX = (extra->pos.x + BRICK_HEIGHT) / BRICK_SIZE;
const int32 tmpY = extra->pos.y / BRICK_HEIGHT;
const int32 tmpZ = (extra->pos.z + BRICK_HEIGHT) / BRICK_SIZE;
@@ -476,6 +478,7 @@ void Redraw::processDrawListExtras(const DrawListStruct &drawCmd) {
// show clipping area
//drawRectBorders(renderRect);
+ _engine->_interface->resetClip();
}
}
@@ -564,6 +567,8 @@ void Redraw::renderOverlays() {
_engine->_text->drawText(renderRect.left, renderRect.top, text);
addRedrawArea(_engine->_interface->_clip);
+
+ _engine->_interface->resetClip();
break;
}
case OverlayType::koNumberRange: {
@@ -588,6 +593,7 @@ void Redraw::renderOverlays() {
_engine->_text->drawText(renderRect.left, renderRect.top, text);
addRedrawArea(_engine->_interface->_clip);
+ _engine->_interface->resetClip();
break;
}
case OverlayType::koInventoryItem: {
@@ -603,6 +609,7 @@ void Redraw::renderOverlays() {
_engine->_menu->drawRectBorders(rect);
addRedrawArea(rect);
_engine->_gameState->initEngineProjections();
+ _engine->_interface->resetClip();
break;
}
case OverlayType::koText: {
@@ -627,6 +634,7 @@ void Redraw::renderOverlays() {
_engine->_text->drawText(renderRect.left, renderRect.top, text);
addRedrawArea(_engine->_interface->_clip);
+ _engine->_interface->resetClip();
break;
}
}
@@ -732,9 +740,10 @@ void Redraw::drawBubble(int32 actorIdx) {
renderRect.right = spriteWidth + renderRect.left - 1;
renderRect.bottom = spriteHeight + renderRect.top - 1;
- _engine->_interface->setClip(renderRect);
- _engine->_grid->drawSprite(renderRect.left, renderRect.top, spritePtr);
- _engine->_interface->resetClip();
+ if (_engine->_interface->setClip(renderRect)) {
+ _engine->_grid->drawSprite(renderRect.left, renderRect.top, spritePtr);
+ _engine->_interface->resetClip();
+ }
}
void Redraw::zoomScreenScale() {
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index ba0f9058c6..9932d178ab 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1563,6 +1563,7 @@ void Renderer::renderBehaviourModel(const Common::Rect &rect, int32 y, int32 ang
} else {
renderIsoModel(0, y, 0, ANGLE_0, angle, ANGLE_0, bodyData, dummy);
}
+ _engine->_interface->resetClip();
}
void Renderer::renderInventoryItem(int32 x, int32 y, const BodyData &bodyData, int32 angle, int32 param) {
diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index c2e2531764..1a6f00c41e 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -445,6 +445,7 @@ void GameState::processFoundItem(InventoryItems item) {
_engine->_text->stopVox(_engine->_text->_currDialTextEntry);
_engine->_scene->_sceneHero->_animTimerData = tmpAnimTimer;
+ _engine->_interface->resetClip();
}
void GameState::processGameChoices(TextId choiceIdx) {
Commit: f4461e742458ab76ac59832ae13e23a138a7214e
https://github.com/scummvm/scummvm/commit/f4461e742458ab76ac59832ae13e23a138a7214e
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-10-11T20:31:58+02:00
Commit Message:
TWINE: make sure we have a proper clip value set
Changed paths:
engines/twine/renderer/redraw.cpp
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index d1b443605a..e1b00a8104 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -352,6 +352,7 @@ void Redraw::processDrawListActors(const DrawListStruct &drawCmd, bool bgRedraw)
if (actorIdx == OWN_ACTOR_SCENE_INDEX) {
if (_engine->_actor->_cropBottomScreen) {
+ _engine->_interface->resetClip();
_engine->_interface->_clip.bottom = _engine->_actor->_cropBottomScreen;
}
}
Commit: cae51f4222a91edd89d5a9d35088f28edf763a39
https://github.com/scummvm/scummvm/commit/cae51f4222a91edd89d5a9d35088f28edf763a39
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-10-11T20:31:58+02:00
Commit Message:
TWINE: ensure that the clip is properly reset
Changed paths:
engines/twine/menu/menu.cpp
engines/twine/renderer/redraw.cpp
diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index f33db70ed8..1df4c50c90 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -1155,6 +1155,7 @@ void Menu::drawInventoryItems(int32 left, int32 top) {
for (int32 item = 0; item < NUM_INVENTORY_ITEMS; item++) {
drawItem(left, top, item);
}
+ _engine->_interface->resetClip();
}
void Menu::processInventoryMenu() {
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index e1b00a8104..5bf6c2a066 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -352,12 +352,12 @@ void Redraw::processDrawListActors(const DrawListStruct &drawCmd, bool bgRedraw)
if (actorIdx == OWN_ACTOR_SCENE_INDEX) {
if (_engine->_actor->_cropBottomScreen) {
- _engine->_interface->resetClip();
_engine->_interface->_clip.bottom = _engine->_actor->_cropBottomScreen;
}
}
if (!_engine->_renderer->renderIsoModel(delta.x, delta.y, delta.z, ANGLE_0, actor->_angle, ANGLE_0, _engine->_resources->_bodyData[actor->_entity], renderRect)) {
+ _engine->_interface->resetClip();
return;
}
@@ -380,8 +380,8 @@ void Redraw::processDrawListActors(const DrawListStruct &drawCmd, bool bgRedraw)
}
_engine->_debugScene->drawClip(_engine->_interface->_clip);
- _engine->_interface->resetClip();
}
+ _engine->_interface->resetClip();
}
void Redraw::processDrawListActorSprites(const DrawListStruct &drawCmd, bool bgRedraw) {
Commit: 46723348fcbfb5fe30479551ec5169d2f1dc6bda
https://github.com/scummvm/scummvm/commit/46723348fcbfb5fe30479551ec5169d2f1dc6bda
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-10-11T20:31:58+02:00
Commit Message:
TWINE: added clipping to model rendering
this fixes the rendering issue with drowing
Changed paths:
engines/twine/renderer/renderer.cpp
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 9932d178ab..bd4cbf2b5d 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -393,6 +393,36 @@ bool Renderer::computePolygons(int16 polyRenderType, const Vertex *vertices, int
const int16 *colProgressBufEnd = &_colorProgressionBuffer[_polyTabSize - 1];
const int screenHeight = _engine->height();
+ const Common::Rect &clip = _engine->_interface->_clip;
+ if (!clip.isEmpty()) {
+ int32 vleft;
+ int32 vright;
+ int32 vtop;
+ int32 vbottom;
+
+ vleft = vtop = SCENE_SIZE_MAX;
+ vright = vbottom = SCENE_SIZE_MIN;
+
+ for (int32 i = 0; i < numVertices; i++) {
+ if (vertices[i].x < vleft)
+ vleft = vertices[i].x;
+ if (vertices[i].x > vright)
+ vright = vertices[i].x;
+ if (vertices[i].y < vtop)
+ vtop = vertices[i].y;
+ if (vertices[i].y > vbottom)
+ vbottom = vertices[i].y;
+ }
+ // no vertices
+ if (vtop > vbottom) {
+ return false;
+ }
+ if (vright < clip.left - 1 || vleft > clip.right + 1 || vbottom < clip.top - 1 || vtop > clip.bottom + 1) {
+ debug(10, "Clipped %i:%i:%i:%i, clip rect(%i:%i:%i:%i)", vleft, vtop, vright, vbottom, clip.left, clip.top, clip.right, clip.bottom);
+ return false;
+ }
+ }
+
for (int32 nVertex = 0; nVertex < numVertices; nVertex++) {
const int16 oldVertexY = currentVertexY;
const int16 oldVertexX = currentVertexX;
More information about the Scummvm-git-logs
mailing list