mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-20 08:53:51 +00:00
TWINE: moved latest cache entries into Resources class
This commit is contained in:
parent
7d2991aa0b
commit
c34239c7fc
@ -159,7 +159,7 @@ void Actor::initSpriteActor(int32 actorIdx) {
|
||||
ActorStruct *localActor = _engine->_scene->getActor(actorIdx);
|
||||
|
||||
if (localActor->staticFlags.bIsSpriteActor && localActor->sprite != -1 && localActor->entity != localActor->sprite) {
|
||||
const int16 *ptr = (const int16 *)(_engine->_scene->spriteBoundingBoxPtr + localActor->sprite * 16 + 4);
|
||||
const int16 *ptr = (const int16 *)(_engine->_resources->spriteBoundingBoxPtr + localActor->sprite * 16 + 4);
|
||||
|
||||
localActor->entity = localActor->sprite;
|
||||
localActor->boudingBox.x.bottomLeft = *(ptr++);
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "twine/grid.h"
|
||||
#include "twine/movements.h"
|
||||
#include "twine/renderer.h"
|
||||
#include "twine/resources.h"
|
||||
#include "twine/scene.h"
|
||||
#include "twine/twine.h"
|
||||
|
||||
@ -477,7 +478,7 @@ void Collision::stopFalling() { // ReceptionObj()
|
||||
}
|
||||
|
||||
int32 Collision::checkExtraCollisionWithActors(ExtraListStruct *extra, int32 actorIdx) {
|
||||
int16 *spriteBounding = (int16 *)(_engine->_scene->spriteBoundingBoxPtr + extra->info0 * 16 + 4);
|
||||
int16 *spriteBounding = (int16 *)(_engine->_resources->spriteBoundingBoxPtr + extra->info0 * 16 + 4);
|
||||
|
||||
int32 xLeft = *(spriteBounding++) + extra->x;
|
||||
int32 xRight = *(spriteBounding++) + extra->x;
|
||||
@ -539,7 +540,7 @@ int32 Collision::checkExtraCollisionWithBricks(int32 X, int32 Y, int32 Z, int32
|
||||
}
|
||||
|
||||
int32 Collision::checkExtraCollisionWithExtra(ExtraListStruct *extra, int32 extraIdx) {
|
||||
int16 *spriteBounding = (int16 *)(_engine->_scene->spriteBoundingBoxPtr + extra->info0 * 16 + 4);
|
||||
int16 *spriteBounding = (int16 *)(_engine->_resources->spriteBoundingBoxPtr + extra->info0 * 16 + 4);
|
||||
|
||||
int32 xLeft = *(spriteBounding++) + extra->x;
|
||||
int32 xRight = *(spriteBounding++) + extra->x;
|
||||
@ -554,7 +555,7 @@ int32 Collision::checkExtraCollisionWithExtra(ExtraListStruct *extra, int32 extr
|
||||
ExtraListStruct *extraTest = &_engine->_extra->extraList[i];
|
||||
if (i != extraIdx && extraTest->info0 != -1) {
|
||||
// int16 * spriteBoundingTest;
|
||||
// spriteBoundingTest = (int16*)(_engine->_scene->spriteBoundingBoxPtr + extraTest->info0 * 16 + 4);
|
||||
// spriteBoundingTest = (int16*)(_engine->_resources->spriteBoundingBoxPtr + extraTest->info0 * 16 + 4);
|
||||
|
||||
int32 xLeftTest = *(spriteBounding++) + extraTest->x;
|
||||
int32 xRightTest = *(spriteBounding++) + extraTest->x;
|
||||
|
@ -842,9 +842,7 @@ void Extra::processExtras() {
|
||||
}
|
||||
|
||||
if (process) {
|
||||
int16 *spriteBounds;
|
||||
|
||||
spriteBounds = (int16 *)(_engine->_scene->spriteBoundingBoxPtr + extra->info0 * 16 + 8);
|
||||
const int16 *spriteBounds = (const int16 *)(_engine->_resources->spriteBoundingBoxPtr + extra->info0 * 16 + 8);
|
||||
extra->y = (_engine->_collision->collisionY << 8) + 0x100 - *(spriteBounds);
|
||||
extra->type &= 0xFFED;
|
||||
continue;
|
||||
|
@ -408,7 +408,7 @@ void Redraw::redrawEngineActions(int32 bgRedraw) { // fullRedraw
|
||||
_engine->_renderer->projectPositionOnScreen(shadow.x - _engine->_grid->cameraX, shadow.y - _engine->_grid->cameraY, shadow.z - _engine->_grid->cameraZ);
|
||||
|
||||
int32 spriteWidth, spriteHeight;
|
||||
_engine->_grid->getSpriteSize(shadow.field_A, &spriteWidth, &spriteHeight, _engine->_scene->spriteShadowPtr);
|
||||
_engine->_grid->getSpriteSize(shadow.field_A, &spriteWidth, &spriteHeight, _engine->_resources->spriteShadowPtr);
|
||||
|
||||
// calculate sprite size and position on screen
|
||||
renderLeft = _engine->_renderer->projPosX - (spriteWidth / 2);
|
||||
@ -419,7 +419,7 @@ void Redraw::redrawEngineActions(int32 bgRedraw) { // fullRedraw
|
||||
_engine->_interface->setClip(renderLeft, renderTop, renderRight, renderBottom);
|
||||
|
||||
if (_engine->_interface->textWindowLeft <= _engine->_interface->textWindowRight && _engine->_interface->textWindowTop <= _engine->_interface->textWindowBottom) {
|
||||
_engine->_grid->drawSprite(shadow.field_A, renderLeft, renderTop, _engine->_scene->spriteShadowPtr);
|
||||
_engine->_grid->drawSprite(shadow.field_A, renderLeft, renderTop, _engine->_resources->spriteShadowPtr);
|
||||
}
|
||||
|
||||
const int32 tmpX = (shadow.x + 0x100) >> 9;
|
||||
@ -448,8 +448,8 @@ void Redraw::redrawEngineActions(int32 bgRedraw) { // fullRedraw
|
||||
_engine->_grid->getSpriteSize(0, &spriteWidth, &spriteHeight, spritePtr);
|
||||
|
||||
// calculate sprite position on screen
|
||||
renderLeft = _engine->_renderer->projPosX + *((int16 *)(_engine->_scene->spriteBoundingBoxPtr + (actor2->entity * 16)));
|
||||
renderTop = _engine->_renderer->projPosY + *((int16 *)(_engine->_scene->spriteBoundingBoxPtr + (actor2->entity * 16) + 2));
|
||||
renderLeft = _engine->_renderer->projPosX + *((const int16 *)(_engine->_resources->spriteBoundingBoxPtr + (actor2->entity * 16)));
|
||||
renderTop = _engine->_renderer->projPosY + *((const int16 *)(_engine->_resources->spriteBoundingBoxPtr + (actor2->entity * 16) + 2));
|
||||
renderRight = renderLeft + spriteWidth;
|
||||
renderBottom = renderTop + spriteHeight;
|
||||
|
||||
@ -500,8 +500,8 @@ void Redraw::redrawEngineActions(int32 bgRedraw) { // fullRedraw
|
||||
_engine->_grid->getSpriteSize(0, &spriteWidth, &spriteHeight, _engine->_resources->spriteTable[extra->info0]);
|
||||
|
||||
// calculate sprite position on screen
|
||||
renderLeft = _engine->_renderer->projPosX + *(const int16 *)(_engine->_scene->spriteBoundingBoxPtr + extra->info0 * 16);
|
||||
renderTop = _engine->_renderer->projPosY + *(const int16 *)(_engine->_scene->spriteBoundingBoxPtr + extra->info0 * 16 + 2);
|
||||
renderLeft = _engine->_renderer->projPosX + *(const int16 *)(_engine->_resources->spriteBoundingBoxPtr + extra->info0 * 16);
|
||||
renderTop = _engine->_renderer->projPosY + *(const int16 *)(_engine->_resources->spriteBoundingBoxPtr + extra->info0 * 16 + 2);
|
||||
renderRight = renderLeft + spriteWidth;
|
||||
renderBottom = renderTop + spriteHeight;
|
||||
|
||||
@ -562,14 +562,13 @@ void Redraw::redrawEngineActions(int32 bgRedraw) { // fullRedraw
|
||||
// process overlay type
|
||||
switch (overlay->type) {
|
||||
case koSprite: {
|
||||
int16 offsetX, offsetY;
|
||||
int32 spriteWidth, spriteHeight;
|
||||
uint8 *spritePtr = _engine->_resources->spriteTable[overlay->info0];
|
||||
|
||||
_engine->_grid->getSpriteSize(0, &spriteWidth, &spriteHeight, spritePtr);
|
||||
|
||||
offsetX = *((const int16 *)(_engine->_scene->spriteBoundingBoxPtr + (overlay->info0 * 16)));
|
||||
offsetY = *((const int16 *)(_engine->_scene->spriteBoundingBoxPtr + (overlay->info0 * 16) + 2));
|
||||
const int16 offsetX = *((const int16 *)(_engine->_resources->spriteBoundingBoxPtr + (overlay->info0 * 16)));
|
||||
const int16 offsetY = *((const int16 *)(_engine->_resources->spriteBoundingBoxPtr + (overlay->info0 * 16) + 2));
|
||||
|
||||
renderLeft = offsetX + overlay->x;
|
||||
renderTop = offsetY + overlay->y;
|
||||
|
@ -99,11 +99,11 @@ void Resources::initResources() {
|
||||
_engine->_text->setFontColor(14);
|
||||
_engine->_text->setTextCrossColor(136, 143, 2);
|
||||
|
||||
if (_engine->_hqrdepack->hqrGetallocEntry(&_engine->_scene->spriteShadowPtr, Resources::HQR_RESS_FILE, RESSHQR_SPRITESHADOW) == 0) {
|
||||
if (_engine->_hqrdepack->hqrGetallocEntry(&spriteShadowPtr, Resources::HQR_RESS_FILE, RESSHQR_SPRITESHADOW) == 0) {
|
||||
error("Failed to load sprite shadow");
|
||||
}
|
||||
|
||||
if (_engine->_hqrdepack->hqrGetallocEntry(&_engine->_scene->spriteBoundingBoxPtr, Resources::HQR_RESS_FILE, RESSHQR_SPRITEBOXDATA) == 0) {
|
||||
if (_engine->_hqrdepack->hqrGetallocEntry(&spriteBoundingBoxPtr, Resources::HQR_RESS_FILE, RESSHQR_SPRITEBOXDATA) == 0) {
|
||||
error("Failed to load actors bounding box data");
|
||||
}
|
||||
|
||||
|
@ -140,6 +140,9 @@ public:
|
||||
/** Font buffer pointer */
|
||||
uint8 *fontPtr = nullptr;
|
||||
|
||||
uint8 *spriteShadowPtr = nullptr;
|
||||
uint8 *spriteBoundingBoxPtr = nullptr;
|
||||
|
||||
/** Initialize resource pointers */
|
||||
void initResources();
|
||||
|
||||
|
@ -251,9 +251,6 @@ public:
|
||||
int32 currentSceneIdx = LBA1SceneId::Citadel_Island_Prison;
|
||||
int32 previousSceneIdx = LBA1SceneId::Citadel_Island_Prison;
|
||||
|
||||
uint8 *spriteShadowPtr = nullptr;
|
||||
uint8 *spriteBoundingBoxPtr = nullptr;
|
||||
|
||||
int32 currentGameOverScene = 0;
|
||||
int32 alphaLight = 0;
|
||||
int32 betaLight = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user