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

View file

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

View file

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

View file

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