[Scummvm-git-logs] scummvm master -> 9d34f7b68022ee39b9936f29462b931bb768edd9
mduggan
mgithub at guarana.org
Sat May 15 08:18:47 UTC 2021
This automated email contains information about 6 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
edf0797728 ULTIMA8: Wire up more intrinsics for No Regret
4c4b8a6cf5 ULTIMA8: Remove a bit of dead code
f70cb80c30 ULTIMA8: Don't 'land' dead actors in Crusader
21ac02ab46 ULTIMA8: Remove Crusader elevator hack and fix it properly
6d71176b8f ULTIMA8: Improve debug message in ActorAnimProcess
9d34f7b680 ULTIMA8: Crusader rolls should end kneeling
Commit: edf0797728a54105f49cf0806b343d75d8bab564
https://github.com/scummvm/scummvm/commit/edf0797728a54105f49cf0806b343d75d8bab564
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-05-15T17:06:04+09:00
Commit Message:
ULTIMA8: Wire up more intrinsics for No Regret
Changed paths:
engines/ultima/ultima8/usecode/regret_intrinsics.h
engines/ultima/ultima8/world/actors/actor.cpp
engines/ultima/ultima8/world/actors/actor.h
diff --git a/engines/ultima/ultima8/usecode/regret_intrinsics.h b/engines/ultima/ultima8/usecode/regret_intrinsics.h
index a19a22c605..d3018fcf64 100644
--- a/engines/ultima/ultima8/usecode/regret_intrinsics.h
+++ b/engines/ultima/ultima8/usecode/regret_intrinsics.h
@@ -44,7 +44,7 @@ Intrinsic RegretIntrinsics[] = {
World::I_gameDifficulty, // Intrinsic00A()
Item::I_getQLo, // Intrinsic00B()
Item::I_destroy, // Intrinsic00C()
- 0, // Intrinsic00D()
+ Actor::I_getUnkByte, // Intrinsic00D()
Item::I_getX, // Intrinsic00E()
Item::I_getY, // Intrinsic00F()
// 0010
@@ -267,7 +267,7 @@ Intrinsic RegretIntrinsics[] = {
Item::I_getQLo, // Intrinsic0DC()
Item::I_getQHi, // Intrinsic0DD()
Actor::I_getNpcNum, // Intrinsic0DE()
- 0, // Intrinsic0DF() Item::I_setField0x81
+ Actor::I_setUnkByte, // Intrinsic0DF() Item::I_setField0x81
// 00E0
Item::I_hurl, // Intrinsic0E0()
Actor::I_setDead, // Intrinsic0E1()
@@ -297,7 +297,7 @@ Intrinsic RegretIntrinsics[] = {
Actor::I_setDead, // Intrinsic0F8()
Item::I_getQLo, // Intrinsic0F9()
Actor::I_setDead, // Intrinsic0FA()
- 0, // DTable::I_getMaxHPForNPC()
+ Actor::I_getMaxHp, // DTable::I_getMaxHPForNPC()
Actor::I_setHp, // Intrinsic0FC()
Item::I_getQLo, // Intrinsic0FD()
BatteryChargerProcess::I_create, // Intrinsic0FE()
diff --git a/engines/ultima/ultima8/world/actors/actor.cpp b/engines/ultima/ultima8/world/actors/actor.cpp
index 1d6b433600..592b589b81 100644
--- a/engines/ultima/ultima8/world/actors/actor.cpp
+++ b/engines/ultima/ultima8/world/actors/actor.cpp
@@ -2009,6 +2009,13 @@ uint32 Actor::I_getHp(const uint8 *args, unsigned int /*argsize*/) {
return actor->getHP();
}
+uint32 Actor::I_getMaxHp(const uint8 *args, unsigned int /*argsize*/) {
+ ARG_ACTOR_FROM_PTR(actor);
+ if (!actor) return 0;
+
+ return actor->getMaxHP();
+}
+
uint32 Actor::I_getMana(const uint8 *args, unsigned int /*argsize*/) {
ARG_ACTOR_FROM_PTR(actor);
if (!actor) return 0;
diff --git a/engines/ultima/ultima8/world/actors/actor.h b/engines/ultima/ultima8/world/actors/actor.h
index 01ff56c14c..73a86a79a4 100644
--- a/engines/ultima/ultima8/world/actors/actor.h
+++ b/engines/ultima/ultima8/world/actors/actor.h
@@ -338,6 +338,7 @@ public:
INTRINSIC(I_getDex);
INTRINSIC(I_getInt);
INTRINSIC(I_getHp);
+ INTRINSIC(I_getMaxHp);
INTRINSIC(I_getMana);
INTRINSIC(I_getAlignment);
INTRINSIC(I_getEnemyAlignment);
Commit: 4c4b8a6cf5a6f9f9fa0ceb714e4b9bb2bf426639
https://github.com/scummvm/scummvm/commit/4c4b8a6cf5a6f9f9fa0ceb714e4b9bb2bf426639
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-05-15T17:06:04+09:00
Commit Message:
ULTIMA8: Remove a bit of dead code
Changed paths:
engines/ultima/ultima8/gumps/gump.cpp
diff --git a/engines/ultima/ultima8/gumps/gump.cpp b/engines/ultima/ultima8/gumps/gump.cpp
index 0ca1f42431..b2417dfbec 100644
--- a/engines/ultima/ultima8/gumps/gump.cpp
+++ b/engines/ultima/ultima8/gumps/gump.cpp
@@ -254,23 +254,8 @@ void Gump::Paint(RenderSurface *surf, int32 lerp_factor, bool scaled) {
}
void Gump::PaintThis(RenderSurface *surf, int32 /*lerp_factor*/, bool /*scaled*/) {
- if (_shape) {
-#if 0
- Rect sr;
- ShapeFrame *f = shape->getFrame(_frameNum);
- sr.h = f->height;
- sr.w = f->height;
- sr.x = -f->xoff;
- sr.y = -f->yoff;
-
- if (surf->CheckClipped(sr))
-#endif
- surf->Paint(_shape, _frameNum, 0, 0);
-#if 0
- else
- surf->PaintNoClip(shape, _frameNum, 0, 0);
-#endif
- }
+ if (_shape)
+ surf->Paint(_shape, _frameNum, 0, 0);
}
void Gump::PaintChildren(RenderSurface *surf, int32 lerp_factor, bool scaled) {
Commit: f70cb80c30d1d2b8995bfb83b0eadedb80fe23b3
https://github.com/scummvm/scummvm/commit/f70cb80c30d1d2b8995bfb83b0eadedb80fe23b3
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-05-15T17:06:04+09:00
Commit Message:
ULTIMA8: Don't 'land' dead actors in Crusader
Changed paths:
engines/ultima/ultima8/world/gravity_process.cpp
diff --git a/engines/ultima/ultima8/world/gravity_process.cpp b/engines/ultima/ultima8/world/gravity_process.cpp
index 90625b6ee1..b54ed2d56d 100644
--- a/engines/ultima/ultima8/world/gravity_process.cpp
+++ b/engines/ultima/ultima8/world/gravity_process.cpp
@@ -336,7 +336,8 @@ void GravityProcess::actorFallStoppedCru(Actor *actor, int height) {
Animation::Sequence lastanim = actor->getLastAnim();
Kernel *kernel = Kernel::get_instance();
- if (height / 8 > 2 &&
+ if (!actor->isDead() &&
+ height / 8 > 2 &&
(lastanim != Animation::quickJumpCru &&
lastanim != Animation::combatRollLeft &&
lastanim != Animation::combatRollRight &&
@@ -351,14 +352,13 @@ void GravityProcess::actorFallStoppedCru(Actor *actor, int height) {
ProcId lpid = actor->doAnim(Animation::jumpLanding, dir_current);
Animation::Sequence nextanim = actor->isInCombat() ? Animation::combatStand : Animation::stand;
- ProcId spid = actor->doAnim(nextanim, dir_current);
- Process *sp = kernel->getProcess(spid);
- sp->waitFor(lpid);
+ actor->doAnimAfter(nextanim, dir_current, lpid);
// 'ooof' (Note: same sound no is used in No Remorse and No Regret)
AudioProcess *audioproc = AudioProcess::get_instance();
if (audioproc) audioproc->playSFX(0x8f, 250, _itemNum, 0); // CONSTANT!
} else {
+
Process *currentanim = kernel->findProcess(_itemNum, ActorAnimProcess::ACTOR_ANIM_PROC_TYPE);
if (currentanim) {
// TODO: Is this the right thing?
Commit: 21ac02ab4680d55216899615c04f6f36f59a96c2
https://github.com/scummvm/scummvm/commit/21ac02ab4680d55216899615c04f6f36f59a96c2
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-05-15T17:06:30+09:00
Commit Message:
ULTIMA8: Remove Crusader elevator hack and fix it properly
Crusader globs sometimes contain items with an odd z value - eg, stripey floors
or elevators. This is not done in U8 and probably a hack to make the paint
order right in the original, but our scan function was only checking +/-4 and
+/-8 pixels so the avatar would jump 4 pixels up then fall, which was nasty.
Add odd-pixel checks as well when doing a scan in Crusader, and clean up the
old hack. Also tidied up the scan function to make it more understandable.
Changed paths:
engines/ultima/ultima8/world/actors/animation_tracker.cpp
engines/ultima/ultima8/world/current_map.cpp
diff --git a/engines/ultima/ultima8/world/actors/animation_tracker.cpp b/engines/ultima/ultima8/world/actors/animation_tracker.cpp
index b880a3ac3d..aae0e52c87 100644
--- a/engines/ultima/ultima8/world/actors/animation_tracker.cpp
+++ b/engines/ultima/ultima8/world/actors/animation_tracker.cpp
@@ -341,21 +341,12 @@ bool AnimationTracker::step() {
}
if (!targetok || (f.is_onground() && !support)) {
-
// If on ground, try to adjust properly. Never do it for dead Crusader NPCs,
// as they don't get gravity and the death process gets stuck.
// TODO: Profile the effect of disabling this for pathfinding.
// It shouldn't be necessary in that case, and may provide a
// worthwhile speed-up.
if (f.is_onground() && zd > 8 && !(is_crusader && a->isDead())) {
- if (is_crusader && !targetok && support) {
- // Possibly trying to step onto an elevator platform which stops at a z slightly
- // above the floor. Re-scan with a small adjustment.
- // This is a bit of a temporary hack to make navigation possible.. it "hurls"
- // the avatar sometimes.
- tz += 2;
- }
-
targetok = cm->scanForValidPosition(tx, ty, tz, a, _dir,
true, tx, ty, tz);
@@ -383,7 +374,7 @@ bool AnimationTracker::step() {
#ifdef WATCHACTOR
if (a->getObjId() == watchactor) {
- pout << "AnimationTracker: step (" << tx - _x << "," << ty - _y
+ pout << "AnimationTracker: step (" << _x << "," << _y << "," << _z << ") +("<< tx - _x << "," << ty - _y
<< "," << tz - _z << ")" << Std::endl;
}
#endif
@@ -408,24 +399,9 @@ bool AnimationTracker::step() {
a->getShapeInfo()->_flags,
_actor, &support, 0);
-
if (!support) {
_unsupported = true;
return false;
- } else {
-#if 0
- // This check causes really weird behaviour when fall()
- // doesn't make things fall off non-land items, so disabled for now
-
- Item *supportitem = getItem(support);
- assert(supportitem);
- if (!supportitem->getShapeInfo()->is_land()) {
-// pout << "Not land: "; supportitem->dumpInfo();
- // invalid support
- _unsupported = true;
- return false;
- }
-#endif
}
}
diff --git a/engines/ultima/ultima8/world/current_map.cpp b/engines/ultima/ultima8/world/current_map.cpp
index 3c2a3a2afd..ba754d3537 100644
--- a/engines/ultima/ultima8/world/current_map.cpp
+++ b/engines/ultima/ultima8/world/current_map.cpp
@@ -865,17 +865,25 @@ bool CurrentMap::scanForValidPosition(int32 x, int32 y, int32 z, const Item *ite
// TODO: clean this up. Currently the mask arrays are filled with more
// data than is actually used.
const uint32 blockflagmask = (ShapeInfo::SI_SOLID | ShapeInfo::SI_DAMAGING) & item->getShapeInfo()->_flags;
+ if (!blockflagmask)
+ warning("scanForValidPosition non-solid object, should be valid anywhere");
- Direction searchdir = static_cast<Direction>(((int)movedir + 2) % 4);
+ Direction searchdir = static_cast<Direction>(((int)movedir + 4) % 8);
bool xdir = (Direction_XFactor(searchdir) != 0);
bool ydir = (Direction_YFactor(searchdir) != 0);
- // mark everything as valid, but without support
- uint32 validmask[17];
- uint32 supportmask[17];
- for (int i = 0; i < 17; ++i) {
- validmask[i] = 0x1FFFF;
+ int searchtype = ((int)searchdir / 2);
+
+ // The number of grid points on each side of x/y/z to scan.
+ const int scansize = GAME_IS_CRUSADER ? 10 : 8;
+
+ // Mark everything as valid, but without support. We only use SCANSIZE * 2 + 1 bits of the mask
+ // but fill them all for simplicity. Mask arrays are bigger than needed for either game.
+ uint32 validmask[24];
+ uint32 supportmask[24];
+ for (int i = 0; i < scansize * 2 + 1; ++i) {
+ validmask[i] = 0xFFFFFFFF;
supportmask[i] = 0;
}
@@ -884,7 +892,7 @@ bool CurrentMap::scanForValidPosition(int32 x, int32 y, int32 z, const Item *ite
// Note on scan direction:
// The 'horiz' variable below will always mean a direction in
- // the positive x/y directions, with the exception of searchdir 1,
+ // the positive x/y directions, with the exception of searchtype 1,
// in which case positive horiz points in the (positive x, negative y)
// direction.
@@ -899,8 +907,7 @@ bool CurrentMap::scanForValidPosition(int32 x, int32 y, int32 z, const Item *ite
for (int cx = minx; cx <= maxx; cx++) {
for (int cy = miny; cy <= maxy; cy++) {
- item_list::const_iterator iter;
- for (iter = _items[cx][cy].begin();
+ for (item_list::const_iterator iter = _items[cx][cy].begin();
iter != _items[cx][cy].end(); ++iter) {
const Item *citem = *iter;
if (citem->getObjId() == item->getObjId())
@@ -919,14 +926,13 @@ bool CurrentMap::scanForValidPosition(int32 x, int32 y, int32 z, const Item *ite
int minv = iz - z - zd + 1;
int maxv = iz + izd - z - 1;
- if (minv < -8) minv = -8;
- if (maxv > 8) maxv = 8;
+ if (minv < -scansize) minv = -scansize;
+ if (maxv > scansize) maxv = scansize;
- int sminx, smaxx, sminy, smaxy;
- sminx = ix - ixd + 1 - x;
- smaxx = ix + xd - 1 - x;
- sminy = iy - iyd + 1 - y;
- smaxy = iy + yd - 1 - y;
+ int sminx = ix - ixd + 1 - x;
+ int smaxx = ix + xd - 1 - x;
+ int sminy = iy - iyd + 1 - y;
+ int smaxy = iy + yd - 1 - y;
int minh = -100;
int maxh = 100;
@@ -939,26 +945,26 @@ bool CurrentMap::scanForValidPosition(int32 x, int32 y, int32 z, const Item *ite
minh = sminx;
if (xdir && maxh > smaxx)
maxh = smaxx;
- if ((ydir && searchdir != 1) && minh < sminy)
+ if ((ydir && searchtype != 1) && minh < sminy)
minh = sminy;
- if ((ydir && searchdir != 1) && maxh > smaxy)
+ if ((ydir && searchtype != 1) && maxh > smaxy)
maxh = smaxy;
- if (searchdir == 1 && minh < -smaxy)
+ if (searchtype == 1 && minh < -smaxy)
minh = -smaxy;
- if (searchdir == 1 && maxh > -sminy)
+ if (searchtype == 1 && maxh > -sminy)
maxh = -sminy;
- if (minh < -8) minh = -8;
- if (maxh > 8) maxh = 8;
+ if (minh < -scansize) minh = -scansize;
+ if (maxh > scansize) maxh = scansize;
for (int j = minv; j <= maxv; ++j)
for (int i = minh; i <= maxh; ++i)
- validmask[j + 8] &= ~(1 << (i + 8));
+ validmask[j + scansize] &= ~(1 << (i + scansize));
if (wantsupport && si->is_solid() &&
- iz + izd >= z - 8 && iz + izd <= z + 8) {
+ iz + izd >= z - scansize && iz + izd <= z + scansize) {
for (int i = minh; i <= maxh; ++i)
- supportmask[iz + izd - z + 8] |= (1 << (i + 8));
+ supportmask[iz + izd - z + scansize] |= (1 << (i + scansize));
}
}
@@ -968,40 +974,45 @@ bool CurrentMap::scanForValidPosition(int32 x, int32 y, int32 z, const Item *ite
bool foundunsupported = false;
#if 0
- for (unsigned int i = 0; i < 17; ++i) {
- pout.printf("%05x | %05x\n", validmask[16 - i], supportmask[16 - i]);
+ pout.Print("valid | support\n");
+ for (unsigned int i = 0; i < SCANSIZE * 2 + 1; ++i) {
+ pout.Print("%05x | %05x\n", validmask[SCANSIZE * 2 - i], supportmask[SCANSIZE * 2 - i]);
}
- pout.printf("-----------\n");
+ pout.Print("-----------\n");
#endif
- for (unsigned int i = 0; i < 3; ++i) {
- int horiz;
- if (i % 2 == 0)
- horiz = 4 * (i / 2);
- else
- horiz = -4 - 4 * (i / 2);
-
- for (unsigned int j = 0; j < 5; ++j) {
- int vert;
- if (j % 2 == 0)
- vert = 4 * (j / 2);
- else
- vert = -4 - 4 * (j / 2);
-
- if (validmask[vert + 8] & (1 << (horiz + 8))) {
+ //
+ // Crusader also has some floor pieces and elevators which are 1 z-pixel offset,
+ // presumably to fix render-order issues. We need to be able to step up/down
+ // to them smoothly.
+ //
+ static const int SEARCH_OFFSETS_U8[] = {0, -4, 4, -8, 8};
+ static const int SEARCH_OFFSETS_CRU[] = {0, -1, 1, -4, 4, -5, 5, -8, 8, -9, 9};
+
+ const int *search_offsets = GAME_IS_CRUSADER ? SEARCH_OFFSETS_CRU : SEARCH_OFFSETS_U8;
+ const unsigned int nhoriz = GAME_IS_CRUSADER ? 7 : 3;
+ const unsigned int nvert = GAME_IS_CRUSADER ? 11 : 5;
+ for (unsigned int i = 0; i < nhoriz; ++i) {
+ const int horiz = search_offsets[i];
+
+ for (unsigned int j = 0; j < nvert; ++j) {
+ const int vert = search_offsets[j];
+ const uint32 checkbit = (1 << (horiz + scansize));
+
+ if (validmask[vert + scansize] & checkbit) {
if (!wantsupport || !foundunsupported ||
- (supportmask[vert + 8] & (1 << (horiz + 8)))) {
+ (supportmask[vert + scansize] & checkbit)) {
tz = z + vert;
tx = x;
- if (searchdir != 0)
+ if (searchtype != 0)
tx += horiz;
ty = y;
- if (searchdir == 1)
+ if (searchtype == 1)
ty -= horiz;
- else if (searchdir != 2)
+ else if (searchtype != 2)
ty += horiz;
}
- if (!wantsupport || (supportmask[vert + 8] & (1 << (horiz + 8))))
+ if (!wantsupport || (supportmask[vert + scansize] & checkbit))
return true;
foundunsupported = true;
}
Commit: 6d71176b8f03ddcba30e6b18bc7f61103cf4b499
https://github.com/scummvm/scummvm/commit/6d71176b8f03ddcba30e6b18bc7f61103cf4b499
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-05-15T17:06:36+09:00
Commit Message:
ULTIMA8: Improve debug message in ActorAnimProcess
Changed paths:
engines/ultima/ultima8/world/actors/actor_anim_process.cpp
diff --git a/engines/ultima/ultima8/world/actors/actor_anim_process.cpp b/engines/ultima/ultima8/world/actors/actor_anim_process.cpp
index e4d35770e9..1fe4955903 100644
--- a/engines/ultima/ultima8/world/actors/actor_anim_process.cpp
+++ b/engines/ultima/ultima8/world/actors/actor_anim_process.cpp
@@ -313,6 +313,10 @@ void ActorAnimProcess::run() {
_tracker->getPosition(x2, y2, z2);
a->collideMove(x2, y2, z2, false, true); // forced move
a->setFrame(_tracker->getFrame());
+ } else {
+ x2 = x;
+ y2 = y;
+ z2 = z;
}
}
@@ -332,11 +336,12 @@ void ActorAnimProcess::run() {
#ifdef WATCHACTOR
if (_itemNum == watchactor) {
pout << "Animation [" << Kernel::get_instance()->getFrameNum()
- << "] showing frame (" << x << "," << y << "," << z << ")"
- << " shape (" << a->getShape() << "," << _tracker->getFrame()
+ << "] showing frame (" << x << "," << y << "," << z << ")-("
+ << x2 << "," << y2 << "," << z2 << ")"
+ << " shp (" << a->getShape() << "," << _tracker->getFrame()
<< ") sfx " << _tracker->getAnimFrame()->_sfx
<< " rep " << _repeatCounter << ConsoleStream::hex
- << " flags " << _tracker->getAnimFrame()->_flags << " "
+ << " flg " << _tracker->getAnimFrame()->_flags << " "
<< ConsoleStream::dec;
if (_tracker->isDone()) pout << "D";
Commit: 9d34f7b68022ee39b9936f29462b931bb768edd9
https://github.com/scummvm/scummvm/commit/9d34f7b68022ee39b9936f29462b931bb768edd9
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-05-15T17:17:39+09:00
Commit Message:
ULTIMA8: Crusader rolls should end kneeling
Even when they started standing. Match the original behavior.
Changed paths:
engines/ultima/ultima8/world/actors/actor.cpp
diff --git a/engines/ultima/ultima8/world/actors/actor.cpp b/engines/ultima/ultima8/world/actors/actor.cpp
index 592b589b81..6f84bea3fc 100644
--- a/engines/ultima/ultima8/world/actors/actor.cpp
+++ b/engines/ultima/ultima8/world/actors/actor.cpp
@@ -495,6 +495,8 @@ uint16 Actor::doAnim(Animation::Sequence anim, Direction dir, unsigned int steps
anim == Animation::kneelAndFireLargeWeapon ||
anim == Animation::kneelCombatRollLeft ||
anim == Animation::kneelCombatRollRight ||
+ anim == Animation::combatRollLeft ||
+ anim == Animation::combatRollRight ||
anim == Animation::kneelingAdvance ||
anim == Animation::kneelingRetreat) {
setActorFlag(ACT_KNEELING);
More information about the Scummvm-git-logs
mailing list