TRECISION: Move FTexture to Actor, introduce initTextures, some renaming

This commit is contained in:
Strangerke 2021-05-14 21:51:14 +01:00 committed by SupSuper
parent d14108efca
commit e342de5d3f
5 changed files with 48 additions and 43 deletions

View file

@ -75,6 +75,34 @@ Actor::~Actor() {
// delete _texture;
}
void Actor::initTextures() {
// head
uint8 idx = 0;
_textureArea[idx]._dx = 300 / 2;
_textureArea[idx]._dy = 208 / 2;
_textureArea[idx]._angle = 0;
_textureArea[idx]._texture = _vm->_textureArea;
_textureArea[idx]._flag = TEXTUREACTIVE + TEXTURECYLIND;
// body
idx = 1;
_textureArea[idx]._dx = 300;
_textureArea[idx]._dy = 300;
_textureArea[idx]._angle = 0;
_textureArea[idx]._texture = _textureArea[0]._texture + (300 * 208) / 4;
_textureArea[idx]._flag = TEXTUREACTIVE + TEXTURECYLIND;
// arms
idx = 2;
_textureArea[idx]._dx = 300;
_textureArea[idx]._dy = 150;
_textureArea[idx]._angle = 0;
_textureArea[idx]._texture = _textureArea[1]._texture + 300 * 300;
_textureArea[idx]._flag = TEXTUREACTIVE + TEXTURECYLIND;
_texture = (STexture *)&_textureArea[0];
}
static const float _vertsCorr[104][3] = {
0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,
0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f,

View file

@ -32,13 +32,15 @@ class Actor {
private:
TrecisionEngine *_vm;
STexture _textureArea[MAXMAT];
public:
Actor(TrecisionEngine *vm);
~Actor();
SVertex *_characterArea;
SVertex *_vertex;
SFace *_face;
SLight *_light;
SCamera *_camera;
@ -66,6 +68,7 @@ public:
void actorStop();
void read3D(Common::SeekableReadStream *ff);
float frameCenter(SVertex *v);
void initTextures();
}; // end of class

View file

@ -200,7 +200,7 @@ TrecisionEngine::~TrecisionEngine() {
delete[] _textureArea;
delete[] _icons;
delete _actor;
delete[] TextArea;
delete[] _textArea;
for (int i = 0; i < MAXOBJINROOM; ++i) {
delete[] _objPointers[i];
@ -557,9 +557,9 @@ void TrecisionEngine::loadAll() {
int numFileRef = dataNl.readSint32LE();
dataNl.skip(numFileRef * (12 + 4)); // fileRef name + offset
dataNl.read(TextArea, MAXTEXTAREA);
dataNl.read(_textArea, MAXTEXTAREA);
_textPtr = TextArea;
_textPtr = _textArea;
for (int a = 0; a < MAXOBJNAME; a++)
_objName[a] = getNextSentence();

View file

@ -120,10 +120,9 @@ class TrecisionEngine : public Engine {
void openSys();
Graphics::Surface *convertScummVMThumbnail(Graphics::Surface *thumbnail);
STexture FTexture[MAXMAT];
SLight VLight[MAXLIGHT];
SCamera FCamera;
char *TextArea;
SLight _lightArea[MAXLIGHT];
SCamera _cameraArea;
char *_textArea;
public:
TrecisionEngine(OSystem *syst, const ADGameDescription *desc);

View file

@ -192,42 +192,17 @@ Graphics::Surface *TrecisionEngine::convertScummVMThumbnail(Graphics::Surface *t
}
void TrecisionEngine::openSys() {
// head
int32 idx = 0;
FTexture[idx]._dx = 300 / 2;
FTexture[idx]._dy = 208 / 2;
FTexture[idx]._angle = 0;
FTexture[idx]._texture = _textureArea;
FTexture[idx]._flag = TEXTUREACTIVE + TEXTURECYLIND;
// body
idx = 1;
FTexture[idx]._dx = 300;
FTexture[idx]._dy = 300;
FTexture[idx]._angle = 0;
FTexture[idx]._texture = FTexture[0]._texture + (300 * 208) / 4;
FTexture[idx]._flag = TEXTUREACTIVE + TEXTURECYLIND;
// arms
idx = 2;
FTexture[idx]._dx = 300;
FTexture[idx]._dy = 150;
FTexture[idx]._angle = 0;
FTexture[idx]._texture = FTexture[1]._texture + 300 * 300;
FTexture[idx]._flag = TEXTUREACTIVE + TEXTURECYLIND;
delete _actor;
_actor = new Actor(this);
_actor->initTextures();
_actor->readModel("jm.om");
_actor->_light = (SLight *)&VLight;
_actor->_camera = (SCamera *)&FCamera;
_actor->_texture = (STexture *)&FTexture[0];
_actor->_light = (SLight *)&_lightArea;
_actor->_camera = (SCamera *)&_cameraArea;
TextArea = new char[MAXTEXTAREA];
_textArea = new char[MAXTEXTAREA];
_graphicsMgr->clearScreen();
_graphicsMgr->hideCursor();
}
@ -281,7 +256,7 @@ void TrecisionEngine::processTime() {
}
void TrecisionEngine::processMouse() {
static bool MaskMouse;
static bool maskMouse;
static Common::Point oldMousePos;
static bool lastMouseOn = true;
int16 mx = _mousePos.x;
@ -300,12 +275,12 @@ void TrecisionEngine::processMouse() {
return;
if (_mouseLeftBtn || _mouseRightBtn) {
if (!MaskMouse) {
if (!maskMouse) {
_scheduler->doEvent(MC_MOUSE, _mouseRightBtn ? ME_MRIGHT : ME_MLEFT, MP_DEFAULT, mx, my, 0, 0);
MaskMouse = true;
maskMouse = true;
}
} else {
MaskMouse = false;
maskMouse = false;
if (!_flagscriptactive && (mx != oldMousePos.x || my != oldMousePos.y)) {
_scheduler->doEvent(MC_MOUSE, ME_MMOVE, MP_DEFAULT, mx, my, 0, 0);