mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-10 21:03:31 +00:00
TWINE: renamed members and use constants
This commit is contained in:
parent
40e53bd4ef
commit
f8641cf823
@ -344,7 +344,7 @@ void Actor::hitActor(int32 actorIdx, int32 actorIdxAttacked, int32 strengthOfHit
|
||||
}
|
||||
}
|
||||
|
||||
void Actor::processActorCarrier(int32 actorIdx) { // CheckCarrier
|
||||
void Actor::processActorCarrier(int32 actorIdx) {
|
||||
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
|
||||
if (!actor->_staticFlags.bIsCarrierActor) {
|
||||
return;
|
||||
@ -356,7 +356,7 @@ void Actor::processActorCarrier(int32 actorIdx) { // CheckCarrier
|
||||
}
|
||||
}
|
||||
|
||||
void Actor::processActorExtraBonus(int32 actorIdx) { // GiveExtraBonus
|
||||
void Actor::processActorExtraBonus(int32 actorIdx) {
|
||||
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
|
||||
|
||||
const int bonusSprite = _engine->_extra->getBonusSprite(actor->_bonusParameter);
|
||||
@ -367,10 +367,11 @@ void Actor::processActorExtraBonus(int32 actorIdx) { // GiveExtraBonus
|
||||
_engine->_extra->addExtraBonus(actor->pos(), ANGLE_90, ANGLE_0, bonusSprite, actor->_bonusAmount);
|
||||
_engine->_sound->playSample(Samples::ItemPopup, 1, actor->pos(), actorIdx);
|
||||
} else {
|
||||
ActorStruct *sceneHero = _engine->_scene->_sceneHero;
|
||||
const ActorStruct *sceneHero = _engine->_scene->_sceneHero;
|
||||
const int32 angle = _engine->_movements->getAngleAndSetTargetActorDistance(actor->pos(), sceneHero->pos());
|
||||
_engine->_extra->addExtraBonus(actor->_pos.x, actor->_pos.y + actor->_boudingBox.maxs.y, actor->_pos.z, ANGLE_70, angle, bonusSprite, actor->_bonusAmount);
|
||||
_engine->_sound->playSample(Samples::ItemPopup, 1, actor->_pos.x, actor->_pos.y + actor->_boudingBox.maxs.y, actor->_pos.z, actorIdx);
|
||||
const IVec3 pos(actor->_pos.x, actor->_pos.y + actor->_boudingBox.maxs.y, actor->_pos.z);
|
||||
_engine->_extra->addExtraBonus(pos, ANGLE_70, angle, bonusSprite, actor->_bonusAmount);
|
||||
_engine->_sound->playSample(Samples::ItemPopup, 1, pos, actorIdx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,14 +123,14 @@ void Collision::reajustActorPosition(ShapeType brickShape) {
|
||||
}
|
||||
break;
|
||||
case ShapeType::kDoubleSideStairsLeft1:
|
||||
if (512 - processActor.x - _collision.x <= processActor.z - _collision.z) {
|
||||
if (BRICK_SIZE - processActor.x - _collision.x <= processActor.z - _collision.z) {
|
||||
brickShape = ShapeType::kStairsTopLeft;
|
||||
} else {
|
||||
brickShape = ShapeType::kStairsBottomLeft;
|
||||
}
|
||||
break;
|
||||
case ShapeType::kDoubleSideStairsRight1:
|
||||
if (512 - processActor.x - _collision.x <= processActor.z - _collision.z) {
|
||||
if (BRICK_SIZE - processActor.x - _collision.x <= processActor.z - _collision.z) {
|
||||
brickShape = ShapeType::kStairsTopRight;
|
||||
} else {
|
||||
brickShape = ShapeType::kStairsBottomRight;
|
||||
@ -151,14 +151,14 @@ void Collision::reajustActorPosition(ShapeType brickShape) {
|
||||
}
|
||||
break;
|
||||
case ShapeType::kDoubleSideStairsLeft2:
|
||||
if (512 - processActor.x - _collision.x <= processActor.z - _collision.z) {
|
||||
if (BRICK_SIZE - processActor.x - _collision.x <= processActor.z - _collision.z) {
|
||||
brickShape = ShapeType::kStairsBottomLeft;
|
||||
} else {
|
||||
brickShape = ShapeType::kStairsTopLeft;
|
||||
}
|
||||
break;
|
||||
case ShapeType::kDoubleSideStairsRight2:
|
||||
if (512 - processActor.x - _collision.x <= processActor.z - _collision.z) {
|
||||
if (BRICK_SIZE - processActor.x - _collision.x <= processActor.z - _collision.z) {
|
||||
brickShape = ShapeType::kStairsBottomRight;
|
||||
} else {
|
||||
brickShape = ShapeType::kStairsTopRight;
|
||||
|
@ -51,7 +51,7 @@ Grid::~Grid() {
|
||||
free(_brickTable[i]);
|
||||
}
|
||||
free(_currentGrid);
|
||||
free(_currentBll);
|
||||
free(_currentBlockLibrary);
|
||||
free(_brickInfoBuffer);
|
||||
free(_bricksDataBuffer);
|
||||
}
|
||||
@ -297,8 +297,8 @@ void Grid::loadGridBricks() {
|
||||
const uint8 currentBitMask = 1 << (7 - (i & 7));
|
||||
|
||||
if (currentBitByte & currentBitMask) {
|
||||
uint32 currentBllOffset = READ_LE_UINT32(_currentBll + currentBllEntryIdx);
|
||||
const uint8 *currentBllPtr = _currentBll + currentBllOffset;
|
||||
uint32 currentBllOffset = READ_LE_UINT32(_currentBlockLibrary + currentBllEntryIdx);
|
||||
const uint8 *currentBllPtr = _currentBlockLibrary + currentBllOffset;
|
||||
|
||||
const uint32 bllSizeX = *currentBllPtr++;
|
||||
const uint32 bllSizeY = *currentBllPtr++;
|
||||
@ -444,7 +444,7 @@ bool Grid::initGrid(int32 index) {
|
||||
}
|
||||
|
||||
// load layouts from file
|
||||
if (HQR::getAllocEntry(&_currentBll, Resources::HQR_LBA_BLL_FILE, index) == 0) {
|
||||
if (HQR::getAllocEntry(&_currentBlockLibrary, Resources::HQR_LBA_BLL_FILE, index) == 0) {
|
||||
warning("Failed to load block library index: %i", index);
|
||||
return false;
|
||||
}
|
||||
@ -453,7 +453,7 @@ bool Grid::initGrid(int32 index) {
|
||||
|
||||
createGridMask();
|
||||
|
||||
_numberOfBll = READ_LE_INT32(_currentBll) >> 2;
|
||||
_numberOfBll = READ_LE_INT32(_currentBlockLibrary) >> 2;
|
||||
|
||||
createGridMap();
|
||||
|
||||
@ -594,28 +594,29 @@ bool Grid::drawBrickSprite(int32 index, int32 posX, int32 posY, const uint8 *ptr
|
||||
|
||||
const uint8 *Grid::getBlockBufferGround(const IVec3 &pos, int32 &ground) {
|
||||
const IVec3 &collision = updateCollisionCoordinates(pos.x, pos.y, pos.z);
|
||||
const int32 tempX = collision.x;
|
||||
int32 tempY = collision.y;
|
||||
const int32 tempZ = collision.z;
|
||||
const uint8 *ptr = _blockBuffer + tempY * 2 + tempX * GRID_SIZE_Y * 2 + (tempZ * GRID_SIZE_X) * GRID_SIZE_Y * 2;
|
||||
const uint8 *ptr = _blockBuffer
|
||||
+ collision.y * sizeof(int16)
|
||||
+ collision.x * GRID_SIZE_Y * sizeof(int16)
|
||||
+ collision.z * GRID_SIZE_X * GRID_SIZE_Y * sizeof(int16);
|
||||
|
||||
while (tempY) {
|
||||
int32 collisionY = collision.y;
|
||||
while (collisionY) {
|
||||
if (READ_LE_INT16(ptr)) { // found the ground
|
||||
break;
|
||||
}
|
||||
tempY--;
|
||||
ptr -= 2;
|
||||
collisionY--;
|
||||
ptr -= sizeof(int16);
|
||||
}
|
||||
|
||||
_engine->_collision->_collision.y = tempY;
|
||||
ground = (int16)((tempY + 1) * BRICK_HEIGHT);
|
||||
_engine->_collision->_collision.y = collisionY;
|
||||
ground = (int16)((collisionY + 1) * BRICK_HEIGHT);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
const uint8 *Grid::getBlockLibrary(int32 index) const {
|
||||
const int32 offset = READ_LE_UINT32(_currentBll + 4 * index);
|
||||
return (const uint8 *)(_currentBll + offset);
|
||||
const int32 offset = READ_LE_UINT32(_currentBlockLibrary + 4 * index);
|
||||
return (const uint8 *)(_currentBlockLibrary + offset);
|
||||
}
|
||||
|
||||
void Grid::getBrickPos(int32 x, int32 y, int32 z) {
|
||||
@ -722,7 +723,7 @@ ShapeType Grid::getBrickShape(int32 x, int32 y, int32 z) {
|
||||
uint8 blockIdx = *blockBufferPtr;
|
||||
|
||||
if (blockIdx) {
|
||||
const uint8 *blockPtr = _currentBll;
|
||||
const uint8 *blockPtr = _currentBlockLibrary;
|
||||
|
||||
blockPtr += READ_LE_UINT32(blockPtr + blockIdx * 4 - 4);
|
||||
blockPtr += 3;
|
||||
@ -765,7 +766,7 @@ ShapeType Grid::getBrickShapeFull(int32 x, int32 y, int32 z, int32 y2) {
|
||||
uint8 blockIdx = *blockBufferPtr;
|
||||
|
||||
if (blockIdx) {
|
||||
const uint8 *blockPtr = _currentBll;
|
||||
const uint8 *blockPtr = _currentBlockLibrary;
|
||||
|
||||
blockPtr += READ_LE_UINT32(blockPtr + blockIdx * 4 - 4);
|
||||
blockPtr += 3;
|
||||
@ -837,7 +838,7 @@ int32 Grid::getBrickSoundType(int32 x, int32 y, int32 z) {
|
||||
uint8 blockIdx = *blockBufferPtr;
|
||||
|
||||
if (blockIdx) {
|
||||
const uint8 *blockPtr = _currentBll;
|
||||
const uint8 *blockPtr = _currentBlockLibrary;
|
||||
|
||||
blockPtr += READ_LE_UINT32(blockPtr + blockIdx * 4 - 4);
|
||||
blockPtr += 3;
|
||||
|
@ -159,7 +159,7 @@ private:
|
||||
int32 _currentGridSize = 0;
|
||||
uint8 *_currentGrid = nullptr;
|
||||
/** Current block library pointer */
|
||||
uint8 *_currentBll = nullptr;
|
||||
uint8 *_currentBlockLibrary = nullptr;
|
||||
/** Number of block libraries */
|
||||
int32 _numberOfBll = 0;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user