mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-13 07:14:59 +00:00
TRECISION: New engine
This commit is contained in:
parent
0fdd227a9e
commit
352adbfd78
3
engines/trecision/configure.engine
Normal file
3
engines/trecision/configure.engine
Normal file
@ -0,0 +1,3 @@
|
||||
# This file is included from the main "configure" script
|
||||
# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
|
||||
add_engine trecision "Trecision Adventure Engine" no "" "" "highres 16bit"
|
119
engines/trecision/detection.cpp
Normal file
119
engines/trecision/detection.cpp
Normal file
@ -0,0 +1,119 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "base/plugins.h"
|
||||
#include "engines/advancedDetector.h"
|
||||
|
||||
static const PlainGameDescriptor trecisionGames[] = {
|
||||
{"nl", "Nightlong: Union City Conspiracy"},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
static const ADGameDescription gameDescriptions[] = {
|
||||
{
|
||||
"nl",
|
||||
0,
|
||||
AD_ENTRY1s("data.nl", "7665db13ad2a1ceb576531be3e1efb30", 436228),
|
||||
Common::EN_ANY,
|
||||
Common::kPlatformWindows,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO0()
|
||||
},
|
||||
{
|
||||
"nl",
|
||||
0,
|
||||
AD_ENTRY1s("data.nl", "7665db13ad2a1ceb576531be3e1efb30", 457299),
|
||||
Common::DE_DEU,
|
||||
Common::kPlatformWindows,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO0()
|
||||
},
|
||||
{
|
||||
"nl",
|
||||
0,
|
||||
AD_ENTRY1s("data.nl", "7665db13ad2a1ceb576531be3e1efb30", 436697),
|
||||
Common::ES_ESP,
|
||||
Common::kPlatformWindows,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO0()
|
||||
},
|
||||
{
|
||||
"nl",
|
||||
0,
|
||||
AD_ENTRY1s("data.nl", "7665db13ad2a1ceb576531be3e1efb30", 456209),
|
||||
Common::FR_FRA,
|
||||
Common::kPlatformWindows,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO0()
|
||||
},
|
||||
{
|
||||
"nl",
|
||||
0,
|
||||
AD_ENTRY1s("data.nl", "7665db13ad2a1ceb576531be3e1efb30", 446634),
|
||||
Common::IT_ITA,
|
||||
Common::kPlatformWindows,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO0()
|
||||
},
|
||||
{
|
||||
"nl",
|
||||
0,
|
||||
AD_ENTRY1s("data.nl", "7665db13ad2a1ceb576531be3e1efb30", 432900),
|
||||
Common::RU_RUS,
|
||||
Common::kPlatformWindows,
|
||||
ADGF_NO_FLAGS,
|
||||
GUIO0()
|
||||
},
|
||||
AD_TABLE_END_MARKER
|
||||
};
|
||||
|
||||
} // End of namespace Trecision
|
||||
|
||||
static const char *directoryGlobs[] = {
|
||||
"autorun",
|
||||
0
|
||||
};
|
||||
|
||||
class TrecisionMetaEngineDetection : public AdvancedMetaEngineDetection {
|
||||
public:
|
||||
TrecisionMetaEngineDetection() : AdvancedMetaEngineDetection(Trecision::gameDescriptions, sizeof(ADGameDescription), trecisionGames) {
|
||||
_maxScanDepth = 2;
|
||||
_directoryGlobs = directoryGlobs;
|
||||
_guiOptions = GUIO1(GUIO_NOMIDI);
|
||||
}
|
||||
|
||||
const char *getEngineId() const override {
|
||||
return "trecision";
|
||||
}
|
||||
|
||||
const char *getName() const override {
|
||||
return "Trecision Adventure Engine";
|
||||
}
|
||||
|
||||
const char *getOriginalCopyright() const override {
|
||||
return "(C) 1997-98 Trecision S.p.A.";
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_PLUGIN_STATIC(TRECISION_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, TrecisionMetaEngineDetection);
|
50
engines/trecision/metaengine.cpp
Normal file
50
engines/trecision/metaengine.cpp
Normal file
@ -0,0 +1,50 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "base/plugins.h"
|
||||
#include "engines/advancedDetector.h"
|
||||
|
||||
#include "trecision/trecision.h"
|
||||
|
||||
class TrecisionMetaEngine : public AdvancedMetaEngine {
|
||||
const char *getName() const override {
|
||||
return "trecision";
|
||||
}
|
||||
|
||||
Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
|
||||
bool hasFeature(MetaEngineFeature f) const override;
|
||||
};
|
||||
|
||||
Common::Error TrecisionMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
|
||||
*engine = new Trecision::TrecisionEngine(syst);
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
bool TrecisionMetaEngine::hasFeature(MetaEngineFeature f) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
#if PLUGIN_ENABLED_DYNAMIC(TRECISION)
|
||||
REGISTER_PLUGIN_DYNAMIC(TRECISION, PLUGIN_TYPE_ENGINE, TrecisionMetaEngine);
|
||||
#else
|
||||
REGISTER_PLUGIN_STATIC(TRECISION, PLUGIN_TYPE_ENGINE, TrecisionMetaEngine);
|
||||
#endif
|
43
engines/trecision/module.mk
Normal file
43
engines/trecision/module.mk
Normal file
@ -0,0 +1,43 @@
|
||||
MODULE := engines/trecision
|
||||
|
||||
MODULE_OBJS = \
|
||||
trecision.o \
|
||||
metaengine.o \
|
||||
nl/classes.o \
|
||||
nl/dialog.o \
|
||||
nl/do.o \
|
||||
nl/globvar.o \
|
||||
nl/initmain.o \
|
||||
nl/process.o \
|
||||
nl/regen.o \
|
||||
nl/schedule.o \
|
||||
nl/script.o \
|
||||
nl/string.o \
|
||||
nl/text.o \
|
||||
nl/utility.o \
|
||||
nl/3d/3dact.o \
|
||||
nl/3d/3drend.o \
|
||||
nl/3d/3dvar.o \
|
||||
nl/3d/3dwalk.o \
|
||||
nl/ll/llanim.o \
|
||||
nl/ll/llasm.o \
|
||||
nl/ll/lldec.o \
|
||||
nl/ll/llkbd.o \
|
||||
nl/ll/llmouse.o \
|
||||
nl/ll/llscreen.o \
|
||||
nl/ll/llvideo.o \
|
||||
nl/sys/anim.o \
|
||||
nl/sys/ffile.o \
|
||||
nl/sys/main.o \
|
||||
nl/sys/sound.o
|
||||
|
||||
# This module can be built as a plugin
|
||||
ifeq ($(ENABLE_TRECISION), DYNAMIC_PLUGIN)
|
||||
PLUGIN := 1
|
||||
endif
|
||||
|
||||
# Include common rules
|
||||
include $(srcdir)/rules.mk
|
||||
|
||||
# Detection objects
|
||||
DETECT_OBJS += $(MODULE)/detection.o
|
313
engines/trecision/nl/3d/3dact.cpp
Normal file
313
engines/trecision/nl/3d/3dact.cpp
Normal file
@ -0,0 +1,313 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "trecision/nl/lib/addtype.h"
|
||||
#include "trecision/nl/3d/3dinc.h"
|
||||
#include "trecision/nl/struct.h"
|
||||
#include "trecision/nl/ll/llinc.h"
|
||||
#include "trecision/nl/extern.h"
|
||||
#include "trecision/nl/define.h"
|
||||
#include "trecision/nl/message.h"
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
/*------------------------------------------------
|
||||
Do Action
|
||||
--------------------------------------------------*/
|
||||
void actorDoAction(int whatAction) {
|
||||
int len;
|
||||
extern uint8 _actionLen[];
|
||||
extern uint8 *_actionPointer[];
|
||||
extern uint16 _actionPosition[];
|
||||
|
||||
_curStep = 1;
|
||||
float px = _actor._px + _actor._dx;
|
||||
float pz = _actor._pz + _actor._dz;
|
||||
float theta = _actor._theta;
|
||||
int b = 0;
|
||||
|
||||
_step[b]._px = px;
|
||||
_step[b]._pz = pz;
|
||||
_step[b]._dx = 0.0;
|
||||
_step[b]._dz = 0.0;
|
||||
|
||||
_step[b]._theta = theta;
|
||||
_step[b]._curAction = hSTAND;
|
||||
_step[b]._curFrame = 0;
|
||||
_step[b]._curPanel = _curPanel;
|
||||
|
||||
float t = ((270.0 - theta) * PI2) / 360.0;
|
||||
float ox = cos(t);
|
||||
float oz = sin(t);
|
||||
|
||||
struct SVertex *v = (struct SVertex *)_characterArea;
|
||||
float firstFrame = FRAMECENTER(v);
|
||||
|
||||
if (whatAction > hLAST) {
|
||||
v = (struct SVertex *)(_actionPointer[_actionPosition[actionInRoom(whatAction)]]);
|
||||
len = _actionLen[whatAction];
|
||||
} else {
|
||||
int cfp = 0;
|
||||
int cur = 0;
|
||||
while (cur < whatAction)
|
||||
cfp += _defActionLen[cur++];
|
||||
v = (struct SVertex *)_characterArea + cfp * _actor._vertexNum;
|
||||
|
||||
if (whatAction == hWALKOUT)
|
||||
v = (struct SVertex *)_characterArea + _actor._vertexNum;
|
||||
else if (whatAction == hLAST)
|
||||
v = (struct SVertex *)_characterArea;
|
||||
|
||||
len = _defActionLen[whatAction];
|
||||
}
|
||||
|
||||
for (b = _curStep; b < len + _curStep; b++) {
|
||||
float curLen = FRAMECENTER(v) - firstFrame;
|
||||
|
||||
_step[b]._dx = curLen * ox;
|
||||
_step[b]._dz = curLen * oz;
|
||||
_step[b]._px = px;
|
||||
_step[b]._pz = pz;
|
||||
|
||||
_step[b]._curAction = whatAction;
|
||||
_step[b]._curFrame = b - _curStep;
|
||||
|
||||
_step[b]._theta = theta;
|
||||
_step[b]._curPanel = _curPanel;
|
||||
|
||||
v += _actor._vertexNum;
|
||||
|
||||
if (whatAction > hLAST)
|
||||
v = (struct SVertex *)((uint8 *)v + 4);
|
||||
else if (whatAction == hLAST)
|
||||
v = (struct SVertex *)_characterArea;
|
||||
}
|
||||
|
||||
_step[b]._px = px;
|
||||
_step[b]._pz = pz;
|
||||
_step[b]._dx = 0.0;
|
||||
_step[b]._dz = 0.0;
|
||||
|
||||
_step[b]._theta = theta;
|
||||
_step[b]._curAction = hSTAND;
|
||||
_step[b]._curFrame = 0;
|
||||
_step[b]._curPanel = _curPanel;
|
||||
|
||||
_lastStep = b; // Last step
|
||||
|
||||
// Starts action
|
||||
if (_obj[_curObj]._flag & OBJFLAG_ROOMOUT)
|
||||
doEvent(MC_HOMO, ME_HOMOGOTOEXIT, MP_DEFAULT, _obj[_curObj]._goRoom, 0, _obj[_curObj]._ninv, _curObj);
|
||||
else
|
||||
doEvent(MC_HOMO, ME_HOMODOACTION, MP_DEFAULT, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/*------------------------------------------------
|
||||
Stop character
|
||||
--------------------------------------------------*/
|
||||
void actorStop() {
|
||||
int b = 0;
|
||||
|
||||
_step[b]._px = _actor._px + _actor._dx;
|
||||
_step[b]._pz = _actor._pz + _actor._dz;
|
||||
_step[b]._dx = 0.0;
|
||||
_step[b]._dz = 0.0;
|
||||
|
||||
_step[b]._theta = _actor._theta;
|
||||
_step[b]._curAction = hSTAND;
|
||||
_step[b]._curFrame = 0;
|
||||
_step[b]._curPanel = _curPanel;
|
||||
|
||||
_homoGoToPosition = -1;
|
||||
|
||||
_curStep = 0;
|
||||
_lastStep = 0;
|
||||
}
|
||||
|
||||
/*------------------------------------------------
|
||||
Set Light Position
|
||||
--------------------------------------------------*/
|
||||
void setPosition(int num) {
|
||||
extern struct SLight *_light;
|
||||
|
||||
_light = (struct SLight *)_actor._light;
|
||||
|
||||
for (int a = 0; a < _actor._lightNum; a++) {
|
||||
// If it's off
|
||||
if (_light->_inten == 0) {
|
||||
// If it's the required position
|
||||
if (_light->_position == num) {
|
||||
_actor._px = _light->_x;
|
||||
_actor._pz = _light->_z;
|
||||
_actor._dx = 0.0;
|
||||
_actor._dz = 0.0;
|
||||
|
||||
float ox = _light->_dx;
|
||||
float oz = _light->_dz;
|
||||
|
||||
// If it's a null light
|
||||
if ((ox == 0.0) && (oz == 0.0))
|
||||
warning("setPosition: Unknown error : null light");
|
||||
|
||||
float t = sqrt(ox * ox + oz * oz);
|
||||
ox /= t;
|
||||
oz /= t;
|
||||
|
||||
float theta = sinCosAngle(ox, oz) * 180.0 / PI;
|
||||
if (theta >= 360.0)
|
||||
theta -= 360.0;
|
||||
if (theta < 0.0)
|
||||
theta += 360.0;
|
||||
|
||||
_actor._theta = theta;
|
||||
|
||||
_curStep = 0;
|
||||
_lastStep = 0;
|
||||
_curPanel = -1;
|
||||
_oldPanel = -1;
|
||||
|
||||
_step[0]._px = _actor._px + _actor._dx;
|
||||
_step[0]._pz = _actor._pz + _actor._dz;
|
||||
_step[0]._dx = 0.0;
|
||||
_step[0]._dz = 0.0;
|
||||
|
||||
_step[0]._theta = _actor._theta;
|
||||
_step[0]._curAction = hSTAND;
|
||||
_step[0]._curFrame = 0;
|
||||
_step[0]._curPanel = _curPanel;
|
||||
|
||||
_homoGoToPosition = num;
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
_light ++;
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------
|
||||
Go To Light Position
|
||||
--------------------------------------------------*/
|
||||
void goToPosition(int num) {
|
||||
extern struct SLight *_light;
|
||||
extern float _lookX, _lookZ;
|
||||
|
||||
_light = (struct SLight *)_actor._light;
|
||||
|
||||
for (int a = 0; a < _actor._lightNum; a++) {
|
||||
// If it's off and if it's a position
|
||||
if (_light->_inten == 0) {
|
||||
// If it's the right position
|
||||
if (_light->_position == num) {
|
||||
_curX = _light->_x;
|
||||
_curZ = _light->_z;
|
||||
_lookX = _curX - _light->_dx;
|
||||
_lookZ = _curZ - _light->_dz;
|
||||
|
||||
_curStep = 0;
|
||||
_lastStep = 0;
|
||||
|
||||
_step[0]._px = _actor._px + _actor._dx;
|
||||
_step[0]._pz = _actor._pz + _actor._dz;
|
||||
_step[0]._dx = 0.0;
|
||||
_step[0]._dz = 0.0;
|
||||
|
||||
_step[0]._theta = _actor._theta;
|
||||
_step[0]._curAction = hSTAND;
|
||||
_step[0]._curFrame = 0;
|
||||
_step[0]._curPanel = _curPanel;
|
||||
|
||||
_oldPanel = _curPanel;
|
||||
_curPanel = -1;
|
||||
|
||||
findPath();
|
||||
|
||||
_homoGoToPosition = num;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_light ++;
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------
|
||||
lookAt
|
||||
--------------------------------------------------*/
|
||||
void lookAt(float x, float z) {
|
||||
float ox = _step[_lastStep]._px - x;
|
||||
float oz = _step[_lastStep]._pz - z;
|
||||
|
||||
// If the light is null
|
||||
if ((ox == 0.0) && (oz == 0.0)) {
|
||||
memcpy(&_step[_lastStep + 1], &_step[_lastStep], sizeof(struct SStep));
|
||||
memcpy(&_step[_lastStep + 2], &_step[_lastStep + 1], sizeof(struct SStep));
|
||||
_lastStep += 2;
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
float t = sqrt(ox * ox + oz * oz);
|
||||
ox /= t;
|
||||
oz /= t;
|
||||
|
||||
float theta = sinCosAngle(ox, oz) * 180.0 / PI;
|
||||
if (theta >= 360.0)
|
||||
theta -= 360.0;
|
||||
if (theta < 0.0)
|
||||
theta += 360.0;
|
||||
|
||||
float approx = theta - _step[_lastStep]._theta;
|
||||
|
||||
if ((approx < 30.0) && (approx > -30.0))
|
||||
approx = 0.0;
|
||||
else if (approx > 180.0)
|
||||
approx = -360.0 + approx;
|
||||
else if (approx < -180.0)
|
||||
approx = 360.0 + approx;
|
||||
|
||||
approx /= 3.0;
|
||||
|
||||
// Antepenultimate 1/3
|
||||
_step[_lastStep]._theta += approx;
|
||||
_step[_lastStep]._theta = (_step[_lastStep]._theta > 360.0) ? _step[_lastStep]._theta - 360.0 : (_step[_lastStep]._theta < 0.0) ? _step[_lastStep]._theta + 360.0 : _step[_lastStep]._theta;
|
||||
|
||||
// Penultimate 2/3
|
||||
memcpy(&_step[_lastStep + 1], &_step[_lastStep], sizeof(struct SStep));
|
||||
_lastStep++;
|
||||
_step[_lastStep]._theta += approx;
|
||||
_step[_lastStep]._theta = (_step[_lastStep]._theta > 360.0) ? _step[_lastStep]._theta - 360.0 : (_step[_lastStep]._theta < 0.0) ? _step[_lastStep]._theta + 360.0 : _step[_lastStep]._theta;
|
||||
|
||||
// Last right step
|
||||
memcpy(&_step[_lastStep + 1], &_step[_lastStep], sizeof(struct SStep));
|
||||
_lastStep++;
|
||||
_step[_lastStep]._theta = theta;
|
||||
|
||||
// ????
|
||||
memcpy(&_step[_lastStep + 1], &_step[_lastStep], sizeof(struct SStep));
|
||||
_lastStep++;
|
||||
_step[_lastStep]._theta = theta;
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
173
engines/trecision/nl/3d/3dinc.h
Normal file
173
engines/trecision/nl/3d/3dinc.h
Normal file
@ -0,0 +1,173 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "trecision/nl/3d/3drend.h"
|
||||
#include "trecision/nl/sysdef.h"
|
||||
|
||||
/*--------------------------------------------------
|
||||
Useful global variables:
|
||||
|
||||
_panel s : where the panels are
|
||||
_panelNum i : number of panels
|
||||
_curPanel i : currently affected panel
|
||||
_oldPanel i : starting panel
|
||||
_curX f : X position of the affected panel
|
||||
_curZ f : Z position of the affected panel
|
||||
_cam s : camera
|
||||
_proj f : camera projection matrix
|
||||
_invP f : camera antiprojection matrix
|
||||
_x3d,_y3d,_z3d f : float variables for output functions
|
||||
_x2d, _y2d i : int variables for output functions
|
||||
_cx, _cy i : center of the 2D screen
|
||||
_actor s : actor structure
|
||||
_step s : character frame structure
|
||||
_pathNode s : path nodes
|
||||
_numPathNodes i : number of path nodes
|
||||
_curStep i : current character frame
|
||||
_lastStep i : last character frame
|
||||
_defActionLen u : character default action length
|
||||
--------------------------------------------------*/
|
||||
|
||||
#define PI 3.1415927
|
||||
#define PI2 6.2831853
|
||||
#define EPSILON 0.007
|
||||
|
||||
#define MAXPANELSINROOM 400
|
||||
#define PANELIN 0x20000000
|
||||
|
||||
#define MAXPATHNODES 50
|
||||
|
||||
#define hSTAND 0
|
||||
#define hSTART 1
|
||||
#define hWALK 2
|
||||
#define hEND 3
|
||||
#define hSTOP0 4
|
||||
#define hSTOP1 5
|
||||
#define hSTOP2 6
|
||||
#define hSTOP3 7
|
||||
#define hSTOP4 8
|
||||
#define hSTOP5 9
|
||||
#define hSTOP6 10
|
||||
#define hSTOP7 11
|
||||
#define hSTOP8 12
|
||||
#define hSTOP9 13
|
||||
#define hWALKIN 14
|
||||
#define hBOH 15
|
||||
#define hUSEGG 16
|
||||
#define hUSETT 17
|
||||
#define hWALKOUT 18
|
||||
|
||||
#define hLAST 19 // Last Default Action
|
||||
|
||||
#define MAXSTEP 1000
|
||||
#define FRAMECENTER(v) (-v[86]._z - v[164]._z) / 2.0
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
struct SPan {
|
||||
float _x1, _z1;
|
||||
float _x2, _z2;
|
||||
float _h;
|
||||
int _flags;
|
||||
char _near1;
|
||||
char _near2;
|
||||
char _col1;
|
||||
char _col2;
|
||||
};
|
||||
|
||||
struct SSortPan {
|
||||
int _num;
|
||||
float _min;
|
||||
};
|
||||
|
||||
struct SPathNode {
|
||||
float _x, _z;
|
||||
float _dist;
|
||||
short _oldp;
|
||||
short _curp;
|
||||
};
|
||||
|
||||
struct SStep {
|
||||
float _px, _pz;
|
||||
float _dx, _dz;
|
||||
float _theta;
|
||||
int _curAction;
|
||||
int _curFrame;
|
||||
short _curPanel;
|
||||
};
|
||||
|
||||
struct SActor {
|
||||
struct SVertex *_vertex;
|
||||
struct SFace *_face;
|
||||
struct SLight *_light;
|
||||
struct SCamera *_camera;
|
||||
struct STexture *_texture;
|
||||
|
||||
int _vertexNum;
|
||||
int _faceNum;
|
||||
int _lightNum;
|
||||
int _matNum;
|
||||
|
||||
float _px, _py, _pz;
|
||||
float _dx, _dz;
|
||||
float _theta;
|
||||
int _lim[6];
|
||||
|
||||
int _curFrame;
|
||||
int _curAction;
|
||||
};
|
||||
|
||||
|
||||
extern struct SPan _panel[];
|
||||
extern struct SSortPan _sortPan[];
|
||||
extern struct SPathNode _pathNode[];
|
||||
extern struct SStep _step[];
|
||||
extern struct SActor _actor;
|
||||
|
||||
extern float _proj[3][3];
|
||||
extern float _invP[3][3];
|
||||
|
||||
extern int _panelNum;
|
||||
extern int _actorPos;
|
||||
extern int _forcedActorPos;
|
||||
|
||||
extern int _cx, _cy;
|
||||
extern int _x2d, _y2d;
|
||||
|
||||
extern float _x3d, _y3d, _z3d;
|
||||
|
||||
extern int _curPanel, _oldPanel;
|
||||
extern float _curX, _curZ;
|
||||
|
||||
extern int _numPathNodes;
|
||||
extern int _numSortPan;
|
||||
extern int _curStep;
|
||||
extern int _lastStep;
|
||||
|
||||
extern uint8 _defActionLen[];
|
||||
|
||||
extern LLBOOL _shadowSplit;
|
||||
|
||||
} // End of namespace Trecision
|
||||
|
||||
#include "trecision/nl/3d/3dproto.h"
|
||||
|
79
engines/trecision/nl/3d/3dproto.h
Normal file
79
engines/trecision/nl/3d/3dproto.h
Normal file
@ -0,0 +1,79 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* aLONG with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
void warning(const char *format, ...);
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
int actionInRoom(int curA);
|
||||
void actorDoAction(int whatAction);
|
||||
void actorStop();
|
||||
int actorDoNextFrame();
|
||||
void setPosition(int num);
|
||||
void goToPosition(int num);
|
||||
void lookAt(float x, float z);
|
||||
float sinCosAngle(float sinus, float cosinus);
|
||||
void createTextureMapping(int16 mat);
|
||||
uint16 shadow(uint32 val, uint8 num);
|
||||
uint16 aliasing(uint32 val1, uint32 val2, uint8 num);
|
||||
void textureTriangle(int32 x1, int32 y1, int32 z1, int32 c1, int32 tx1, int32 ty1, int32 x2, int32 y2, int32 z2, int32 c2, int32 tx2, int32 ty2, int32 x3, int32 y3, int32 z3, int32 c3, int32 tx3, int32 ty3, struct STexture *t);
|
||||
void textureScanEdge(int32 x1, int32 y1, int32 z1, int32 c1, int32 tx1, int32 ty1, int32 x2, int32 y2, int32 z2, int32 c2, int32 tx2, int32 ty2);
|
||||
void shadowTriangle(int32 x1, int32 y1, int32 x2, int32 y2, int32 x3, int32 y3, uint8 cv, int32 zv);
|
||||
void shadowScanEdge(int32 x1, int32 y1, int32 x2, int32 y2);
|
||||
void gouraudTriangle(int32 x1, int32 y1, int32 z1, int32 c1, int32 x2, int32 y2, int32 z2, int32 c2, int32 x3, int32 y3, int32 z3, int32 c3, uint32 *mat);
|
||||
void gouraudScanEdge(int32 x1, int32 y1, int32 z1, int32 c1, int32 x2, int32 y2, int32 z2, int32 c2);
|
||||
void init3DRoom(int16 dx, uint16 *destBuffer, int16 *zBuffer);
|
||||
void setClipping(int16 x1, int16 y1, int16 x2, int16 y2);
|
||||
void setZBufferRegion(int16 sx, int16 sy, int16 dx);
|
||||
signed char clockWise(int16 x1, int16 y1, int16 x2, int16 y2, int16 x3, int16 y3);
|
||||
void drawCharacter(uint8 flag);
|
||||
int read3D(const char *c);
|
||||
void findPath();
|
||||
void findShortPath();
|
||||
float evalPath(int a, float destX, float destZ, int nearP);
|
||||
void buildFramelist();
|
||||
int nextStep();
|
||||
void displayPath();
|
||||
int findAttachedPanel(int srcP, int destP);
|
||||
int pointInside(int pan, double x, double z);
|
||||
int pathCompare(const void *arg1, const void *arg2);
|
||||
void sortPath();
|
||||
float distF(float x1, float y1, float x2, float y2);
|
||||
float dist3D(float x1, float y1, float z1, float x2, float y2, float z2);
|
||||
void putPix(int x, int y, uint16 c);
|
||||
void cross3D(float x, float y, float z, uint16 c);
|
||||
void whereIs(int px, int py);
|
||||
void pointOut();
|
||||
void putLine(int x0, int y0, int x1, int y1, uint16 c);
|
||||
void viewPanel(struct SPan *p);
|
||||
void pointProject(float x, float y, float z);
|
||||
void invPointProject(int x, int y);
|
||||
int intersectLinePanel(struct SPan *p, float x, float y, float z);
|
||||
int intersectLineFloor(float x, float y, float z);
|
||||
int intersectLineLine(float xa, float ya, float xb, float yb, float xc, float yc, float xd, float yd);
|
||||
void initSortPan();
|
||||
int panCompare(const void *arg1, const void *arg2);
|
||||
void sortPanel();
|
||||
void actorOrder();
|
||||
char waitKey();
|
||||
|
||||
} // End of namespace Trecision
|
1027
engines/trecision/nl/3d/3drend.cpp
Normal file
1027
engines/trecision/nl/3d/3drend.cpp
Normal file
File diff suppressed because it is too large
Load Diff
94
engines/trecision/nl/3d/3drend.h
Normal file
94
engines/trecision/nl/3d/3drend.h
Normal file
@ -0,0 +1,94 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#define MAXVERTEX 1000
|
||||
#define MAXFACE 1000
|
||||
|
||||
#define CALCPOINTS 1
|
||||
#define DRAWFACES 2
|
||||
#define DOALL 3
|
||||
|
||||
#define TEXTUREACTIVE 1
|
||||
#define TEXTUREPLANAR 2
|
||||
#define TEXTURECYLIND 4
|
||||
#define TEXTURELATERAL 8
|
||||
|
||||
#define SHADOWAMBIENT 27 // 0 (black) ... 127 (blank) shadow colors - opposite
|
||||
#define LIGHTRANGE 2048.0 // after 127 * val the light doesn't have an effect (deleted)
|
||||
#define CHARACTERMIDSIZE 91.0 // character half height
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
struct SVertex {
|
||||
float _x, _y, _z;
|
||||
float _nx, _ny, _nz;
|
||||
};
|
||||
|
||||
struct SFace {
|
||||
uint16 _a, _b, _c;
|
||||
uint16 _mat;
|
||||
};
|
||||
|
||||
struct SLight {
|
||||
float _x, _y, _z;
|
||||
float _dx, _dy, _dz;
|
||||
float _inr, _outr;
|
||||
uint8 _hotspot;
|
||||
uint8 _fallOff;
|
||||
int8 _inten;
|
||||
int8 _position;
|
||||
};
|
||||
|
||||
struct SCamera {
|
||||
float _ex, _ey, _ez;
|
||||
float _e1[3];
|
||||
float _e2[3];
|
||||
float _e3[3];
|
||||
float _fovX, _fovY;
|
||||
};
|
||||
|
||||
struct STexture {
|
||||
int16 _dx, _dy, _angle;
|
||||
uint8 *_texture;
|
||||
uint8 *_palette;
|
||||
uint8 _flag;
|
||||
};
|
||||
|
||||
/*------------------------------------------------
|
||||
Create reference table for the vertices of
|
||||
a texture
|
||||
--------------------------------------------------*/
|
||||
void createTextureMapping(int16 mat);
|
||||
/*------------------------------------------------
|
||||
Initialize a 3D Room
|
||||
--------------------------------------------------*/
|
||||
void init3DRoom(int16 dx, uint16 *destBuffer, int16 *zBuffer);
|
||||
/*------------------------------------------------
|
||||
Change the clipping area
|
||||
--------------------------------------------------*/
|
||||
void setClipping(int16 x1, int16 y1, int16 x2, int16 y2);
|
||||
/*------------------------------------------------
|
||||
Draw the character
|
||||
--------------------------------------------------*/
|
||||
void drawCharacter(uint8 flag);
|
||||
|
||||
} // End of namespace Trecision
|
104
engines/trecision/nl/3d/3dvar.cpp
Normal file
104
engines/trecision/nl/3d/3dvar.cpp
Normal file
@ -0,0 +1,104 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "trecision/nl/lib/addtype.h"
|
||||
#include "trecision/nl/3d/3dinc.h"
|
||||
|
||||
/*------------------------------------------------
|
||||
Useful Global Variables:
|
||||
|
||||
_panel s : Structure containing the panels
|
||||
_panelNum i : Number of panels
|
||||
_curPanel i : current Panel
|
||||
_oldPanel i : starting Panel
|
||||
_curX f : X position of the affected Panel
|
||||
_curZ f : Z position of the affected Panel
|
||||
_cam s : Camera
|
||||
_proj f : camera projection matrix
|
||||
_invP f : camera antiprojection matrix
|
||||
_x3d, _y3d, _z3d f : Float variables for the ouput functions
|
||||
_x2d, _y2d i : Int variables for the ouput functions
|
||||
_cx, _cy i : Center of the 2D screen
|
||||
_actor s : Actor structure
|
||||
_step s : Character frame struture
|
||||
_pathNode s : Path nodes
|
||||
_numPathNodes i : Number of nodes
|
||||
_curStep i : Character current frame
|
||||
_lastStep i : character last frame
|
||||
_defActionLen u : Default character action length
|
||||
--------------------------------------------------*/
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
struct SPan _panel[MAXPANELSINROOM];
|
||||
struct SSortPan _sortPan[32];
|
||||
struct SPathNode _pathNode[MAXPATHNODES];
|
||||
|
||||
struct SStep _step[MAXSTEP];
|
||||
struct SActor _actor;
|
||||
|
||||
float _proj[3][3];
|
||||
float _invP[3][3];
|
||||
|
||||
int _panelNum;
|
||||
int _actorPos;
|
||||
int _forcedActorPos;
|
||||
|
||||
int _cx, _cy;
|
||||
int _x2d, _y2d;
|
||||
|
||||
float _x3d, _y3d, _z3d;
|
||||
|
||||
int _curPanel = - 1, _oldPanel = - 1;
|
||||
float _curX, _curZ;
|
||||
|
||||
int _numPathNodes;
|
||||
int _numSortPan;
|
||||
int _curStep;
|
||||
int _lastStep;
|
||||
|
||||
uint8 _defActionLen[hLAST + 1] = {
|
||||
/* STAND */ 1,
|
||||
/* PARTE */ 1,
|
||||
/* WALK */ 10,
|
||||
/* END */ 1,
|
||||
/* STOP0 */ 3,
|
||||
/* STOP1 */ 4,
|
||||
/* STOP2 */ 3,
|
||||
/* STOP3 */ 2,
|
||||
/* STOP4 */ 3,
|
||||
/* STOP5 */ 4,
|
||||
/* STOP6 */ 3,
|
||||
/* STOP7 */ 3,
|
||||
/* STOP8 */ 2,
|
||||
/* STOP9 */ 3,
|
||||
/* WALKI */ 12,
|
||||
/* BOH */ 9,
|
||||
/* UGG */ 41,
|
||||
/* UTT */ 35,
|
||||
/* WALKO */ 12,
|
||||
/* LAST */ 15
|
||||
};
|
||||
|
||||
LLBOOL _shadowSplit;
|
||||
|
||||
} // End of namespace Trecision
|
1789
engines/trecision/nl/3d/3dwalk.cpp
Normal file
1789
engines/trecision/nl/3d/3dwalk.cpp
Normal file
File diff suppressed because it is too large
Load Diff
981
engines/trecision/nl/classes.cpp
Normal file
981
engines/trecision/nl/classes.cpp
Normal file
@ -0,0 +1,981 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <conio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "trecision/nl/lib/addtype.h"
|
||||
#include "trecision/nl/3d/3dinc.h"
|
||||
#include "trecision/nl/sysdef.h"
|
||||
#include "trecision/nl/struct.h"
|
||||
#include "trecision/nl/define.h"
|
||||
#include "trecision/nl/message.h"
|
||||
#include "trecision/nl/extern.h"
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
extern int32 CurRoomMaxX;
|
||||
extern uint16 _playingAnims[];
|
||||
|
||||
// inventory
|
||||
#define COUNTERSTEP 6
|
||||
//PELS: e qui ci si gioca l'inv con accellerazione ***********
|
||||
int16 InvSpeed[8] = { 20, 10, 5, 3, 2};
|
||||
int InvSpeedIndex = 0;
|
||||
uint32 ScrollInvTime;
|
||||
|
||||
// gestioni particolari
|
||||
uint16 ruota = -1, ruotepos[3];
|
||||
|
||||
// gestione serpente via
|
||||
message Serp52;
|
||||
int FastWalk = false, FastWalkLocked = false;
|
||||
|
||||
int ForceQuit = 0;
|
||||
int NlVer = 102;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* DOACTION */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void doAction() {
|
||||
if ((TheMessage->event == ME_MOUSEOPERATE) || (TheMessage->event == ME_MOUSEEXAMINE)) {
|
||||
// Azione sulla zona GAME
|
||||
_curObj = TheMessage->lparam;
|
||||
if (_curObj == oLASTLEV5) CharacterSay(2003);
|
||||
if ((!_curObj) || (!(_obj[_curObj]._mode & OBJMODE_OBJSTATUS))) return;
|
||||
|
||||
if (_obj[_curObj]._mode & OBJMODE_HIDDEN)
|
||||
_obj[_curObj]._mode &= ~OBJMODE_HIDDEN;
|
||||
|
||||
if (SemUseWithStarted) {
|
||||
if ((_obj[_curObj]._flag & (OBJFLAG_ROOMOUT | OBJFLAG_ROOMIN)) && !(_obj[_curObj]._flag & OBJFLAG_EXAMINE)) return;
|
||||
SemUseWithStarted = false;
|
||||
SemInventoryLocked = false;
|
||||
UseWith[WITH] = _curObj;
|
||||
UseWithInv[WITH] = false;
|
||||
LightIcon = 0xff;
|
||||
|
||||
if ((!UseWithInv[USED]) && (_curObj == UseWith[USED])) {
|
||||
UseWith[USED] = 0;
|
||||
UseWith[WITH] = 0;
|
||||
UseWithInv[USED] = false;
|
||||
UseWithInv[WITH] = false;
|
||||
SemUseWithStarted = false;
|
||||
ClearText();
|
||||
} else
|
||||
doEvent(MC_ACTION, ME_USEWITH, MP_SYSTEM, 0, 0, 0, 0);
|
||||
_curObj = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((TheMessage->event == ME_MOUSEOPERATE) && (_obj[_curObj]._flag & OBJFLAG_USEWITH)) {
|
||||
SemUseWithStarted = true;
|
||||
SemInventoryLocked = true;
|
||||
UseWith[USED] = _curObj;
|
||||
UseWith[WITH] = 0;
|
||||
UseWithInv[USED] = false;
|
||||
UseWithInv[WITH] = false;
|
||||
ShowObjName(_curObj, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (TheMessage->event) {
|
||||
case ME_MOUSEOPERATE:
|
||||
if (_obj[_curObj]._flag & OBJFLAG_ROOMIN) doRoomIn(_curObj);
|
||||
else if (_obj[_curObj]._flag & OBJFLAG_PERSON) doMouseTalk(_curObj);
|
||||
else if (_obj[_curObj]._flag & OBJFLAG_ROOMOUT) doRoomOut(_curObj);
|
||||
else if (_obj[_curObj]._flag & OBJFLAG_TAKE) doMouseTake(_curObj);
|
||||
else doMouseOperate(_curObj);
|
||||
break;
|
||||
|
||||
case ME_MOUSEEXAMINE:
|
||||
if (_obj[_curObj]._flag & OBJFLAG_EXAMINE) doMouseExamine(_curObj);
|
||||
else if (_obj[_curObj]._flag & OBJFLAG_ROOMIN) doRoomIn(_curObj);
|
||||
else if (_obj[_curObj]._flag & OBJFLAG_PERSON) doMouseExamine(_curObj);
|
||||
else if (_obj[_curObj]._flag & OBJFLAG_ROOMOUT) doRoomOut(_curObj);
|
||||
else doMouseExamine(_curObj);
|
||||
break;
|
||||
|
||||
case ME_INVOPERATE:
|
||||
doInvOperate();
|
||||
break;
|
||||
|
||||
case ME_INVEXAMINE:
|
||||
doInvExamine();
|
||||
break;
|
||||
|
||||
case ME_USEWITH:
|
||||
ShowObjName(0, false);
|
||||
doUseWith();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* DOMOUSE */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void doMouse() {
|
||||
#define POSUP 0
|
||||
#define POSGAME 1
|
||||
#define POSINV 2
|
||||
|
||||
static int8 lastpos;
|
||||
int8 curpos;
|
||||
|
||||
switch (TheMessage->event) {
|
||||
case ME_MMOVE:
|
||||
if (GAMEAREA(TheMessage->wparam2)) curpos = POSGAME;
|
||||
else if (INVAREA(TheMessage->wparam2)) curpos = POSINV;
|
||||
else curpos = POSUP;
|
||||
|
||||
// Zona GAME
|
||||
if (curpos == POSGAME) {
|
||||
lastpos = POSGAME;
|
||||
if ((SemSomeOneSpeak) || (SemDialogMenuActive) || (SemDialogActive) || (SemUseWithLocked)) break;
|
||||
CheckMask(TheMessage->wparam1, TheMessage->wparam2);
|
||||
// per la ruota della 2C
|
||||
if ((_curObj >= oRUOTA1A2C) && (_curObj <= oRUOTA12C2C))
|
||||
ShowObjName((oRUOTA1A2C % 3) + oRUOTAA2C, true);
|
||||
// per il dislocatore
|
||||
else if (_curRoom == r41D) {
|
||||
if ((_curObj >= oPULSANTE1AD) && (_curObj <= oPULSANTE33AD)) {
|
||||
if (!(_obj[oROOM41 + _obj[_curObj]._goRoom - r41]._mode & OBJMODE_OBJSTATUS)) {
|
||||
int a;
|
||||
for (a = oROOM41; a <= oROOM4X; a++) {
|
||||
if (_obj[a]._mode & OBJMODE_OBJSTATUS)
|
||||
_obj[a]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
}
|
||||
_obj[oROOM45B]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
|
||||
if (((oROOM41 + _obj[_curObj]._goRoom - r41) == oROOM45) && (_obj[od44ALLA45]._goRoom == r45S))
|
||||
_obj[oROOM45B]._mode |= OBJMODE_OBJSTATUS;
|
||||
else
|
||||
_obj[oROOM41 + _obj[_curObj]._goRoom - r41]._mode |= OBJMODE_OBJSTATUS;
|
||||
RegenRoom();
|
||||
}
|
||||
} else {
|
||||
int a;
|
||||
for (a = oROOM41; a <= oROOM4X; a++) {
|
||||
if (_obj[a]._mode & OBJMODE_OBJSTATUS)
|
||||
_obj[a]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
}
|
||||
_obj[oROOM45B]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
|
||||
RegenRoom();
|
||||
}
|
||||
ShowObjName(_curObj, true);
|
||||
} else
|
||||
// fine ruota e dislocatore
|
||||
ShowObjName(_curObj, true);
|
||||
|
||||
if (_inventoryStatus == INV_INACTION)
|
||||
doEvent(MC_INVENTORY, ME_CLOSE, MP_DEFAULT, 0, 0, 0, 0);
|
||||
}
|
||||
// Zona INVENTORY
|
||||
else if (curpos == POSINV) {
|
||||
lastpos = POSINV;
|
||||
if ((!SemCharacterExist) && ((_curRoom != r31P) && (_curRoom != r35P))) break; // Se sono in stanze senza omino tipo la mappa
|
||||
if (((SemSomeOneSpeak) && !(SemCharacterSpeak)) || (SemDialogMenuActive) || (SemDialogActive) || (SemUseWithLocked)) break;
|
||||
if (_playingAnims[1]) break;
|
||||
|
||||
if (_inventoryStatus == INV_OFF)
|
||||
doEvent(MC_INVENTORY, ME_OPEN, MP_DEFAULT, 0, 0, 0, 0);
|
||||
else if (_inventoryStatus == INV_INACTION)
|
||||
doEvent(MC_INVENTORY, ME_SHOWICONNAME, MP_DEFAULT, TheMessage->wparam1, TheMessage->wparam2, 0, 0);
|
||||
}
|
||||
// Zona UP
|
||||
else {
|
||||
if (_curRoom == rSYS) break;
|
||||
|
||||
_curObj = 0;
|
||||
ShowObjName(_curObj, true);
|
||||
// if( lastpos != POSUP )
|
||||
// ShowObjName(0,false);
|
||||
lastpos = POSUP;
|
||||
|
||||
if (SemDialogMenuActive)
|
||||
UpdateScelte(TheMessage->wparam1, TheMessage->wparam2);
|
||||
}
|
||||
break;
|
||||
|
||||
case ME_MRIGHT:
|
||||
case ME_MLEFT:
|
||||
// if(Semskiptalk) break;
|
||||
if (SemSomeOneSpeak) {
|
||||
Semskiptalk = Semskipenable;
|
||||
break;
|
||||
}
|
||||
if (_actor._curAction > hWALKIN) break;
|
||||
if (SemWalkNoInterrupt && (_actor._curAction != hSTAND)) break;
|
||||
|
||||
if ((SemDialogActive) && (SemDialogMenuActive)) {
|
||||
ScegliScelta(TheMessage->wparam1, TheMessage->wparam2);
|
||||
break;
|
||||
}
|
||||
// per il dislocatore
|
||||
if ((_curObj >= oPULSANTE1AD) && (_curObj <= oPULSANTE33AD)) {
|
||||
if ((_obj[_curObj]._goRoom == r45) && (_obj[od44ALLA45]._goRoom == r45S) &&
|
||||
(_obj[oEXIT41D]._goRoom == r45S) && (TheMessage->event == ME_MRIGHT))
|
||||
doEvent(MC_ACTION, ME_MOUSEOPERATE, MP_DEFAULT, 0, 0, 0, _curObj);
|
||||
else if ((_obj[_curObj]._goRoom == r45) && (_obj[od44ALLA45]._goRoom == r45S) &&
|
||||
(_obj[oEXIT41D]._goRoom != r45S) && (TheMessage->event == ME_MRIGHT)) {
|
||||
_obj[oEXIT41D]._goRoom = r45S;
|
||||
InvObj[iDISLOCATORE]._flag |= OBJFLAG_EXTRA;
|
||||
doEvent(MC_SYSTEM, ME_CHANGEROOM, MP_SYSTEM, r45S, 0, 0, _curObj);
|
||||
} else if (_obj[oEXIT41D]._goRoom != _obj[_curObj]._goRoom && (TheMessage->event == ME_MRIGHT)) {
|
||||
_obj[oEXIT41D]._goRoom = _obj[_curObj]._goRoom;
|
||||
InvObj[iDISLOCATORE]._flag |= OBJFLAG_EXTRA;
|
||||
doEvent(MC_SYSTEM, ME_CHANGEROOM, MP_SYSTEM, _obj[oEXIT41D]._goRoom, 0, 0, _curObj);
|
||||
} else if ((TheMessage->event == ME_MLEFT) && (_curObj))
|
||||
doEvent(MC_ACTION, ME_MOUSEEXAMINE, MP_DEFAULT, 0, 0, 0, _curObj);
|
||||
else if ((TheMessage->event == ME_MRIGHT) && (_curObj))
|
||||
doEvent(MC_ACTION, ME_MOUSEOPERATE, MP_DEFAULT, 0, 0, 0, _curObj);
|
||||
break;
|
||||
}
|
||||
// fine dislocatore
|
||||
// serpente scappa 52
|
||||
else if (_curRoom == r52) {
|
||||
if (_obj[oSERPENTEU52]._mode & OBJMODE_OBJSTATUS)
|
||||
if (GAMEAREA(TheMessage->wparam2) && !SemUseWithStarted && (_curObj != oSERPENTEU52)) {
|
||||
StartCharacterAction(a526, 0, 1, 0);
|
||||
_obj[oSCAVO51]._anim = a516;
|
||||
memcpy(&Serp52, TheMessage, sizeof(Serp52));
|
||||
break;
|
||||
}
|
||||
}
|
||||
// fine serpente scappa 52
|
||||
// sys
|
||||
else if (_curRoom == rSYS) {
|
||||
CheckMask(TheMessage->wparam1, TheMessage->wparam2);
|
||||
DoSys(_curObj);
|
||||
break;
|
||||
}
|
||||
// fine sys
|
||||
|
||||
// Se sono in stanze senza omino tipo la mappa o libro
|
||||
if ((SemCharacterExist == false)/* && (GAMEAREA(TheMessage->wparam2))*/) {
|
||||
if ((INVAREA(TheMessage->wparam2)) && ((_curRoom == r31P) || (_curRoom == r35P))) {
|
||||
if (ICONAREA(TheMessage->wparam1, TheMessage->wparam2) && (WhatIcon(TheMessage->wparam1)) && (_inventoryStatus == INV_INACTION)) {
|
||||
UseWith[WITH] = 0;
|
||||
_curObj = 0;
|
||||
LightIcon = 0xFF;
|
||||
RegenInv(TheIconBase, INVENTORY_SHOW);
|
||||
if (TheMessage->event == ME_MRIGHT)
|
||||
doEvent(MC_INVENTORY, ME_OPERATEICON, MP_DEFAULT, TheMessage->wparam1, TheMessage->wparam2, 0, 0);
|
||||
else if (SemUseWithStarted)
|
||||
doEvent(MC_INVENTORY, ME_OPERATEICON, MP_DEFAULT, TheMessage->wparam1, TheMessage->wparam2, 0, 0);
|
||||
else
|
||||
doEvent(MC_INVENTORY, ME_EXAMINEICON, MP_DEFAULT, TheMessage->wparam1, TheMessage->wparam2, 0, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ((TheMessage->event == ME_MLEFT) && (_curObj))
|
||||
doEvent(MC_ACTION, ME_MOUSEEXAMINE, MP_DEFAULT, 0, 0, 0, _curObj);
|
||||
else if ((TheMessage->event == ME_MRIGHT) && (_curObj))
|
||||
doEvent(MC_ACTION, ME_MOUSEOPERATE, MP_DEFAULT, 0, 0, 0, _curObj);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// gestione particolare ruote 2C
|
||||
if ((_obj[oBASERUOTE2C]._mode & OBJMODE_OBJSTATUS) && (_curRoom == r2C)) {
|
||||
if (CheckMask(TheMessage->wparam1, TheMessage->wparam2)) {
|
||||
if ((_curObj >= oRUOTA1A2C) && (_curObj <= oRUOTA12C2C))
|
||||
ruota = (_curObj - oRUOTA1A2C) % 3;
|
||||
else if (_curObj == oPULSANTE2C) {
|
||||
extern uint16 *SmackImagePointer, *ImagePointer;
|
||||
if (TheMessage->event == ME_MLEFT) {
|
||||
doEvent(MC_ACTION, ME_MOUSEEXAMINE, MP_DEFAULT, 0, 0, 0, _curObj);
|
||||
break;
|
||||
}
|
||||
AnimTab[aBKG2C].flag &= ~SMKANIM_OFF1;
|
||||
_obj[oBASERUOTE2C]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[omRUOTE2C]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[oPULSANTE2C]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[ruotepos[0] * 3 + 0 + oRUOTA1A2C]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[ruotepos[1] * 3 + 1 + oRUOTA1A2C]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[ruotepos[2] * 3 + 2 + oRUOTA1A2C]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
|
||||
_obj[oCAMPO2C]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[oTEMPIO2C]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[oLEONE2C]._mode |= OBJMODE_OBJSTATUS;
|
||||
//_obj[od2CALLA2D]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[oSFINGE2C]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[oSTATUA2C]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[od2CALLA2E]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[oCARTELLOA2C]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[od2CALLA26]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[oRUOTE2C]._mode |= OBJMODE_OBJSTATUS;
|
||||
SemShowHomo = true;
|
||||
RegenRoom();
|
||||
memcpy(SmackImagePointer, ImagePointer, MAXX * AREA * 2);
|
||||
StartSmackAnim(Room[_curRoom]._bkgAnim);
|
||||
|
||||
// combinazione giusta
|
||||
if ((ruotepos[0] == 7) && (ruotepos[1] == 5) && (ruotepos[2] == 11)) {
|
||||
doEvent(MC_HOMO, ME_HOMOACTION, MP_DEFAULT, a2C6PREMEPULSANTEAPERTURA, 0, 0, _curObj);
|
||||
_obj[oSFINGE2C]._flag &= ~OBJFLAG_PERSON;
|
||||
} else
|
||||
doEvent(MC_HOMO, ME_HOMOACTION, MP_DEFAULT, a2C6PREMEPULSANTE, 0, 0, _curObj);
|
||||
|
||||
break;
|
||||
} else
|
||||
break;
|
||||
|
||||
if (TheMessage->event == ME_MLEFT)
|
||||
ruotepos[ruota] = (ruotepos[ruota] > 10) ? 0 : ruotepos[ruota] + 1;
|
||||
if (TheMessage->event == ME_MRIGHT)
|
||||
ruotepos[ruota] = (ruotepos[ruota] < 1) ? 11 : ruotepos[ruota] - 1;
|
||||
|
||||
NLPlaySound(wRUOTE2C);
|
||||
_obj[_curObj]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[ruotepos[ruota] * 3 + ruota + oRUOTA1A2C]._mode |= OBJMODE_OBJSTATUS;
|
||||
RegenRoom();
|
||||
}
|
||||
break;
|
||||
}
|
||||
// fine gestione particolare
|
||||
|
||||
// Zona GAME
|
||||
if (GAMEAREA(TheMessage->wparam2) && (!_playingAnims[1])) {
|
||||
int pmousex, pmousey;
|
||||
|
||||
if (Semscriptactive) _curObj = TheMessage->lparam;
|
||||
|
||||
pmousex = TheMessage->wparam1;
|
||||
pmousey = TheMessage->wparam2;
|
||||
if (!(AtMouseClick(_curObj))) {
|
||||
if (CheckMask(TheMessage->wparam1, TheMessage->wparam2)) {
|
||||
if ((_obj[_curObj]._lim[2] - _obj[_curObj]._lim[0]) < MAXX / 7) {
|
||||
pmousex = (_obj[_curObj]._lim[0] + _obj[_curObj]._lim[2]) / 2;
|
||||
pmousey = ((_obj[_curObj]._lim[1] + _obj[_curObj]._lim[3]) / 2) + TOP;
|
||||
}
|
||||
}
|
||||
whereIs(pmousex, pmousey);
|
||||
findPath();
|
||||
}
|
||||
InitQueue(&Homo);
|
||||
|
||||
if (CheckMask(TheMessage->wparam1, TheMessage->wparam2) && (!SemDialogActive)) {
|
||||
if ((_curRoom == r1D) && !(Room[r1D]._flag & OBJFLAG_EXTRA) && (_curObj != oSCALA1D))
|
||||
_curObj = oDONNA1D;
|
||||
else if ((_curRoom == r2B) && (Room[r2B]._flag & OBJFLAG_EXTRA) && (_curObj != oCARTELLO2B) && (_curObj != od2BALLA28)) {
|
||||
ClearText();
|
||||
_curObj = oPORTA2B;
|
||||
StartCharacterAction(a2B1PROVAAPRIREPORTA, 0, 0, 0);
|
||||
if (SemUseWithStarted) {
|
||||
if (UseWithInv[USED]) {
|
||||
LightIcon = 0xFF;
|
||||
StopSmackAnim(InvObj[UseWith[USED]]._anim);
|
||||
RegenInv(RegenInvStartIcon, INVENTORY_HIDE);
|
||||
SemInventoryLocked = false;
|
||||
}
|
||||
UseWith[USED] = 0;
|
||||
UseWith[WITH] = 0;
|
||||
UseWithInv[USED] = false;
|
||||
UseWithInv[WITH] = false;
|
||||
SemUseWithStarted = false;
|
||||
ClearText();
|
||||
}
|
||||
break;
|
||||
} else if ((_curRoom == r35) && !(Room[r35]._flag & OBJFLAG_EXTRA) && ((_curObj == oSPORTELLOC35) || (_curObj == oSPORTELLOA35) || (_curObj == oASCENSORE35) || (_curObj == oMONITOR35) || (_curObj == oSEDIA35) || (_curObj == oRIBELLEA35) || (_curObj == oCOMPUTER35) || (_curObj == oGIORNALE35))) {
|
||||
_curObj = oLASTLEV5;
|
||||
doEvent(MC_HOMO, ME_HOMOGOTOEXAMINE, MP_DEFAULT, TheMessage->wparam1, TheMessage->wparam2, 0, _curObj);
|
||||
if (SemUseWithStarted) {
|
||||
if (UseWithInv[USED]) {
|
||||
LightIcon = 0xFF;
|
||||
StopSmackAnim(InvObj[UseWith[USED]]._anim);
|
||||
RegenInv(RegenInvStartIcon, INVENTORY_HIDE);
|
||||
SemInventoryLocked = false;
|
||||
}
|
||||
UseWith[USED] = 0;
|
||||
UseWith[WITH] = 0;
|
||||
UseWithInv[USED] = false;
|
||||
UseWithInv[WITH] = false;
|
||||
SemUseWithStarted = false;
|
||||
ClearText();
|
||||
}
|
||||
break;
|
||||
} else if ((TheMessage->event == ME_MLEFT) &&
|
||||
((!(Room[_curRoom]._flag & OBJFLAG_EXTRA) && ((_curObj == oENTRANCE2E) || (_curObj == od24ALLA26) || (_curObj == od21ALLA23 && !(_obj[_curObj]._flag & OBJFLAG_EXAMINE)))) ||
|
||||
((Room[_curRoom]._flag & OBJFLAG_EXTRA) && ((_curObj == od2EALLA2C) || (_curObj == od24ALLA23) || (_curObj == od21ALLA22 && !(_obj[_curObj]._flag & OBJFLAG_EXAMINE)) || (_curObj == od2GVALLA26))))) {
|
||||
doEvent(MC_HOMO, ME_HOMOGOTO, MP_DEFAULT, TheMessage->wparam1, TheMessage->wparam2, 0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
if (TheMessage->event == ME_MRIGHT) {
|
||||
if (!(_obj[_curObj]._flag & OBJFLAG_EXAMINE) && (_curObj != 0)) {
|
||||
if (SemUseWithStarted) {
|
||||
doEvent(MC_HOMO, ME_HOMOGOTO, MP_DEFAULT, TheMessage->wparam1, TheMessage->wparam2, 0, 0);
|
||||
return;
|
||||
} else if (_obj[_curObj]._flag & OBJFLAG_ROOMIN)
|
||||
doEvent(MC_SYSTEM, ME_CHANGEROOM, MP_SYSTEM, _obj[_curObj]._goRoom, _obj[_curObj]._anim, _obj[_curObj]._ninv, _curObj);
|
||||
else if (_obj[_curObj]._flag & OBJFLAG_ROOMOUT)
|
||||
doEvent(MC_SYSTEM, ME_CHANGEROOM, MP_SYSTEM, _obj[_curObj]._goRoom, 0, _obj[_curObj]._ninv, _curObj);
|
||||
actorStop();
|
||||
nextStep();
|
||||
_obj[_curObj]._flag |= OBJFLAG_DONE;
|
||||
} else if (_obj[_curObj]._flag & OBJFLAG_USEWITH) {
|
||||
_homoGoToPosition = -1;
|
||||
actorStop();
|
||||
nextStep();
|
||||
doEvent(MC_ACTION, ME_MOUSEOPERATE, MP_DEFAULT, TheMessage->wparam1, TheMessage->wparam2, 0, _curObj);
|
||||
} else
|
||||
doEvent(MC_HOMO, ME_HOMOGOTOACTION, MP_DEFAULT, TheMessage->wparam1, TheMessage->wparam2, 0, _curObj);
|
||||
} else
|
||||
doEvent(MC_HOMO, ME_HOMOGOTOEXAMINE, MP_DEFAULT, TheMessage->wparam1, TheMessage->wparam2, 0, _curObj);
|
||||
} else if ((SemUseWithStarted) && !(UseWith[WITH]))
|
||||
doEvent(MC_HOMO, ME_HOMOGOTO, MP_DEFAULT, TheMessage->wparam1, TheMessage->wparam2, 0, 0);
|
||||
else
|
||||
doEvent(MC_HOMO, ME_HOMOGOTO, MP_DEFAULT, TheMessage->wparam1, TheMessage->wparam2, 0, 0);
|
||||
}
|
||||
// Zona INVENTORY
|
||||
else if (INVAREA(TheMessage->wparam2)) {
|
||||
if (_playingAnims[1] || SemDialogActive) break;
|
||||
if (_curRoom == rSYS) break;
|
||||
|
||||
if (ICONAREA(TheMessage->wparam1, TheMessage->wparam2) && (WhatIcon(TheMessage->wparam1)) && (_inventoryStatus == INV_INACTION)) {
|
||||
InitQueue(&Homo);
|
||||
actorStop();
|
||||
nextStep();
|
||||
doEvent(MC_HOMO, ME_HOMOGOTOACTION, MP_DEFAULT, TheMessage->wparam1, TheMessage->wparam2, 0, 0);
|
||||
UseWith[WITH] = 0;
|
||||
_curObj = 0;
|
||||
LightIcon = 0xFF;
|
||||
RegenInv(TheIconBase, INVENTORY_SHOW);
|
||||
if (TheMessage->event == ME_MRIGHT)
|
||||
doEvent(MC_INVENTORY, ME_OPERATEICON, MP_DEFAULT, TheMessage->wparam1, TheMessage->wparam2, 0, 0);
|
||||
else if (SemUseWithStarted)
|
||||
doEvent(MC_INVENTORY, ME_OPERATEICON, MP_DEFAULT, TheMessage->wparam1, TheMessage->wparam2, 0, 0);
|
||||
else
|
||||
doEvent(MC_INVENTORY, ME_EXAMINEICON, MP_DEFAULT, TheMessage->wparam1, TheMessage->wparam2, 0, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* DOINVENTORY */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void doInventory() {
|
||||
switch (TheMessage->event) {
|
||||
case ME_OPEN:
|
||||
if ((!SemInventoryLocked) && (_inventoryStatus == INV_OFF) && !(SemDialogActive)) {
|
||||
_inventoryCounter = INVENTORY_HIDE;
|
||||
InvSpeedIndex = 0;
|
||||
_inventoryStatus = INV_PAINT;
|
||||
}
|
||||
break;
|
||||
|
||||
case ME_CLOSE:
|
||||
if ((!SemInventoryLocked) && (_inventoryStatus == INV_INACTION) && !(SemDialogActive)) {
|
||||
_inventoryCounter = INVENTORY_SHOW;
|
||||
InvSpeedIndex = 0;
|
||||
_inventoryStatus = INV_DEPAINT;
|
||||
LightIcon = 0xFF;
|
||||
}
|
||||
break;
|
||||
|
||||
case ME_ONELEFT:
|
||||
if (_inventoryStatus == INV_INACTION) OneLeftInventory();
|
||||
break;
|
||||
|
||||
case ME_ONERIGHT:
|
||||
if (_inventoryStatus == INV_INACTION) OneRightInventory();
|
||||
break;
|
||||
|
||||
case ME_OPERATEICON:
|
||||
CurInventory = WhatIcon(mx);
|
||||
if (CurInventory == 0) break;
|
||||
|
||||
if (SemUseWithStarted) {
|
||||
SemInventoryLocked = false;
|
||||
SemUseWithStarted = false;
|
||||
UseWith[WITH] = CurInventory;
|
||||
UseWithInv[WITH] = true;
|
||||
|
||||
if (UseWith[USED] != CurInventory) {
|
||||
doEvent(MC_ACTION, ME_USEWITH, MP_DEFAULT, 0, 0, 0, 0);
|
||||
LightIcon = 0xFF;
|
||||
} else {
|
||||
StopSmackAnim(InvObj[UseWith[USED]]._anim);
|
||||
ShowInvName(CurInventory, true);
|
||||
LightIcon = CurInventory;
|
||||
}
|
||||
} else if (InvObj[CurInventory]._flag & OBJFLAG_USEWITH) {
|
||||
if ((CurInventory == iCANDELOTTO) && (_curRoom == r29)) {
|
||||
CharacterSay(1565);
|
||||
return;
|
||||
}
|
||||
StartSmackAnim(InvObj[CurInventory]._anim);
|
||||
LightIcon = CurInventory;
|
||||
RegenInv(TheIconBase, INVENTORY_SHOW);
|
||||
SemInventoryLocked = true;
|
||||
SemUseWithStarted = true;
|
||||
UseWith[USED] = CurInventory;
|
||||
UseWithInv[USED] = true;
|
||||
ShowInvName(CurInventory, true);
|
||||
} else doEvent(MC_ACTION, ME_INVOPERATE, MP_DEFAULT, 0, 0, 0, CurInventory);
|
||||
break;
|
||||
|
||||
case ME_EXAMINEICON:
|
||||
CurInventory = WhatIcon(mx);
|
||||
actorStop();
|
||||
nextStep();
|
||||
if (SemUseWithStarted) {
|
||||
SemInventoryLocked = false;
|
||||
SemUseWithStarted = false;
|
||||
UseWith[WITH] = CurInventory;
|
||||
UseWithInv[WITH] = true;
|
||||
if (UseWith[USED] != CurInventory) {
|
||||
doEvent(MC_ACTION, ME_USEWITH, MP_DEFAULT, 0, 0, 0, 0);
|
||||
LightIcon = 0xFF;
|
||||
} else {
|
||||
StopSmackAnim(InvObj[UseWith[USED]]._anim);
|
||||
ShowInvName(CurInventory, true);
|
||||
LightIcon = CurInventory;
|
||||
}
|
||||
} else doEvent(MC_ACTION, ME_INVEXAMINE, MP_DEFAULT, 0, 0, 0, CurInventory);
|
||||
break;
|
||||
|
||||
case ME_SHOWICONNAME:
|
||||
if (ICONAREA(mx, my)) {
|
||||
if (_inventoryStatus != INV_ON) doEvent(MC_INVENTORY, ME_OPEN, MP_DEFAULT, 0, 0, 0, 0);
|
||||
CurInventory = WhatIcon(mx);
|
||||
ShowInvName(CurInventory, true);
|
||||
|
||||
if (!SemUseWithStarted && !SemSomeOneSpeak) {
|
||||
RegenInv(TheIconBase, INVENTORY_SHOW);
|
||||
}
|
||||
} else {
|
||||
if (!(INVAREA(my))) break;
|
||||
ShowInvName(NO_OBJECTS, true);
|
||||
if (!(SemUseWithStarted)) {
|
||||
LightIcon = 0xFF;
|
||||
RegenInv(TheIconBase, INVENTORY_SHOW);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------09/07/97 17.52-------------------
|
||||
StartCharacterAction
|
||||
--------------------------------------------------*/
|
||||
void StartCharacterAction(uint16 Act, uint16 NewRoom, uint8 NewPos, uint16 sent) {
|
||||
InitQueue(&Homo);
|
||||
|
||||
SemInventoryLocked = false;
|
||||
if (Act > hLAST) {
|
||||
StartSmackAnim(Act);
|
||||
InitAtFrameHandler(Act, _curObj);
|
||||
SemMouseEnabled = false;
|
||||
SemShowHomo = 0;
|
||||
doEvent(MC_HOMO, ME_HOMOCONTINUEACTION, MP_DEFAULT, Act, NewRoom, NewPos, _curObj);
|
||||
} else {
|
||||
if ((Act == aWALKIN) || (Act == aWALKOUT))
|
||||
_curObj = 0;
|
||||
SemMouseEnabled = false;
|
||||
actorDoAction(Act);
|
||||
nextStep();
|
||||
}
|
||||
|
||||
if (sent)
|
||||
CharacterTalkInAction(sent);
|
||||
else
|
||||
ClearText();
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* DOHOMO */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void doHomo() {
|
||||
switch (TheMessage->event) {
|
||||
case ME_HOMODOACTION:
|
||||
case ME_HOMOGOTOACTION:
|
||||
case ME_HOMOGOTOEXAMINE:
|
||||
case ME_HOMOGOTOEXIT:
|
||||
case ME_HOMOGOTO:
|
||||
|
||||
if (nextStep()) {
|
||||
_homoInMovement = false;
|
||||
_homoGoToPosition = -1;
|
||||
SemWaitRegen = true;
|
||||
} else
|
||||
_homoInMovement = true;
|
||||
|
||||
if (FastWalk) {
|
||||
if (nextStep()) {
|
||||
_homoInMovement = false;
|
||||
_homoGoToPosition = -1;
|
||||
SemWaitRegen = true;
|
||||
} else
|
||||
_homoInMovement = true;
|
||||
}
|
||||
|
||||
SemPaintHomo = true;
|
||||
|
||||
if (_homoInMovement)
|
||||
REEVENT;
|
||||
else {
|
||||
SemMouseEnabled = true;
|
||||
|
||||
if (TheMessage->event == ME_HOMOGOTOACTION)
|
||||
doEvent(MC_ACTION, ME_MOUSEOPERATE, TheMessage->priority, TheMessage->wparam1, TheMessage->wparam2, 0, TheMessage->lparam);
|
||||
else if (TheMessage->event == ME_HOMOGOTOEXAMINE)
|
||||
doEvent(MC_ACTION, ME_MOUSEEXAMINE, TheMessage->priority, TheMessage->wparam1, TheMessage->wparam2, 0, TheMessage->lparam);
|
||||
else if (TheMessage->event == ME_HOMOGOTOEXIT) {
|
||||
SemShowHomo = 0;
|
||||
doEvent(MC_SYSTEM, ME_CHANGEROOM, TheMessage->priority, TheMessage->wparam1, TheMessage->wparam2, TheMessage->bparam, TheMessage->lparam);
|
||||
} else if (TheMessage->event == ME_HOMODOACTION) {
|
||||
extern uint16 lastobj;
|
||||
lastobj = 0;
|
||||
ShowObjName(_curObj, true);
|
||||
RegenInventory(RegenInvStartIcon, RegenInvStartLine);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ME_HOMOACTION:
|
||||
if (SemWaitRegen)
|
||||
REEVENT;
|
||||
InitQueue(&Homo);
|
||||
RegenInvStartLine = INVENTORY_HIDE;
|
||||
RegenInventory(RegenInvStartIcon, INVENTORY_HIDE);
|
||||
_inventoryStatus = INV_OFF;
|
||||
if (TheMessage->wparam1 > hLAST) {
|
||||
StartSmackAnim(TheMessage->wparam1);
|
||||
InitAtFrameHandler(TheMessage->wparam1, TheMessage->lparam);
|
||||
SemMouseEnabled = false;
|
||||
doEvent(MC_HOMO, ME_HOMOCONTINUEACTION, TheMessage->priority, TheMessage->wparam1, TheMessage->wparam2, TheMessage->bparam, TheMessage->lparam);
|
||||
} else
|
||||
actorDoAction(TheMessage->wparam1);
|
||||
|
||||
ClearText();
|
||||
break;
|
||||
|
||||
case ME_HOMOCONTINUEACTION:
|
||||
SemShowHomo = 0;
|
||||
AtFrameHandler(HOMO_ANIM);
|
||||
// If the animation is over
|
||||
if (!_playingAnims[1]) {
|
||||
extern uint16 lastobj;
|
||||
SemMouseEnabled = true;
|
||||
SemShowHomo = 1;
|
||||
_homoInMovement = false;
|
||||
InitQueue(&Homo);
|
||||
AtFrameEnd(HOMO_ANIM);
|
||||
SemWaitRegen = true;
|
||||
lastobj = 0;
|
||||
ShowObjName(_curObj, true);
|
||||
// If the room changes at the end
|
||||
if (TheMessage->wparam2) {
|
||||
SemShowHomo = 0;
|
||||
doEvent(MC_SYSTEM, ME_CHANGEROOM, MP_SYSTEM, TheMessage->wparam2, 0, TheMessage->bparam, TheMessage->lparam);
|
||||
} else if (TheMessage->bparam)
|
||||
setPosition(TheMessage->bparam);
|
||||
|
||||
if (TheMessage->wparam1 == _obj[oCANCELLATA1B]._anim)
|
||||
if (!(_obj[oBOTTIGLIA1D]._mode & OBJMODE_OBJSTATUS) && !(_obj[oRETE17]._mode & OBJMODE_OBJSTATUS)) {
|
||||
PlayDialog(dF181);
|
||||
SemMouseEnabled = false;
|
||||
setPosition(1);
|
||||
}
|
||||
} else
|
||||
REEVENT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* DOSYSTEM */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void doSystem() {
|
||||
switch (TheMessage->event) {
|
||||
case ME_START:
|
||||
doEvent(MC_SYSTEM, ME_CHANGEROOM, MP_SYSTEM, _curRoom, 0, 0, _curObj);
|
||||
break;
|
||||
|
||||
case ME_REDRAWROOM:
|
||||
RedrawRoom();
|
||||
break;
|
||||
|
||||
case ME_CHANGEROOM:
|
||||
// se oggetto e' sbagliato
|
||||
if (/*( _curObj == 0 ) ||*/ (_curRoom == 0)) {
|
||||
return ;
|
||||
}
|
||||
// se deve ancora fare regen
|
||||
if (SemWaitRegen)
|
||||
REEVENT;
|
||||
|
||||
if ((_curRoom == r41D) && (OldRoom != TheMessage->wparam1))
|
||||
NlDissolve(30);
|
||||
|
||||
OldRoom = _curRoom;
|
||||
_curRoom = TheMessage->wparam1;
|
||||
InitQueue(&Game);
|
||||
InitQueue(&Anim);
|
||||
InitQueue(&Homo);
|
||||
_lastCurInventory = 0;
|
||||
_lastLightIcon = 0xFF;
|
||||
_inventoryStatus = INV_OFF;
|
||||
LightIcon = 0xFF;
|
||||
SemInventoryLocked = false;
|
||||
RegenInvStartLine = INVENTORY_HIDE;
|
||||
_inventoryCounter = INVENTORY_HIDE;
|
||||
RegenInv(RegenInvStartIcon, INVENTORY_HIDE);
|
||||
SemCharacterExist = true;
|
||||
SemShowHomo = true;
|
||||
CurRoomMaxX = SCREENLEN;
|
||||
StopSmackAnim(InvObj[UseWith[USED]]._anim);
|
||||
UseWith[USED] = 0;
|
||||
UseWith[WITH] = 0;
|
||||
UseWithInv[USED] = false;
|
||||
UseWithInv[WITH] = false;
|
||||
SemUseWithStarted = false;
|
||||
SemUseWithLocked = false;
|
||||
LightIcon = 0xFF;
|
||||
SemCharacterSpeak = false;
|
||||
SemSomeOneSpeak = false;
|
||||
actorStop();
|
||||
nextStep();
|
||||
|
||||
// Gestione exit veloci in stanze doppie livello 2
|
||||
if (Room[OldRoom]._flag & OBJFLAG_EXTRA) {
|
||||
if (_curObj == od2EALLA2C) SetRoom(r2E, false);
|
||||
if (_curObj == od24ALLA23) SetRoom(r24, false);
|
||||
if (_curObj == od21ALLA22) SetRoom(r21, false);
|
||||
if (_curObj == od2GVALLA26) SetRoom(r2GV, false);
|
||||
} else {
|
||||
if (_curObj == oENTRANCE2E) SetRoom(r2E, true);
|
||||
if (_curObj == od24ALLA26) SetRoom(r24, true);
|
||||
if (_curObj == od21ALLA23) SetRoom(r21, true);
|
||||
}
|
||||
|
||||
if ((_curRoom == r12) && (OldRoom == r11))
|
||||
AnimTab[aBKG11].flag |= SMKANIM_OFF1;
|
||||
else if ((OldRoom == r2BL) || (OldRoom == r36F))
|
||||
OldRoom = _curRoom;
|
||||
else if (_curRoom == rSYS) {
|
||||
extern short SpeechON, TextON, SpeechVol, MusicVol, SFxVol;
|
||||
if (SpeechON) _obj[o00SPEECHON]._mode |= OBJMODE_OBJSTATUS;
|
||||
else _obj[o00SPEECHOFF]._mode |= OBJMODE_OBJSTATUS;
|
||||
if (TextON) _obj[o00TEXTON]._mode |= OBJMODE_OBJSTATUS;
|
||||
else _obj[o00TEXTOFF]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[o00SPEECH1D + ((SpeechVol) / 25) * 2]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[o00MUSIC1D + ((MusicVol) / 25) * 2]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[o00SOUND1D + ((SFxVol) / 25) * 2]._mode |= OBJMODE_OBJSTATUS;
|
||||
if (SpeechVol < 125) _obj[o00SPEECH1D + ((SpeechVol) / 25) * 2 + 1]._mode |= OBJMODE_OBJSTATUS;
|
||||
if (MusicVol < 125) _obj[o00MUSIC1D + ((MusicVol) / 25) * 2 + 1]._mode |= OBJMODE_OBJSTATUS;
|
||||
if (SFxVol < 125) _obj[o00SOUND1D + ((SFxVol) / 25) * 2 + 1]._mode |= OBJMODE_OBJSTATUS;
|
||||
}
|
||||
|
||||
ReadLoc();
|
||||
SemMouseEnabled = true;
|
||||
|
||||
if ((_curRoom == r21) && ((OldRoom == r23A) || (OldRoom == r23B))) SetRoom(r21, true);
|
||||
else if ((_curRoom == r21) && (OldRoom == r22)) SetRoom(r21, false);
|
||||
else if ((_curRoom == r24) && ((OldRoom == r23A) || (OldRoom == r23B))) SetRoom(r24, false);
|
||||
else if ((_curRoom == r24) && (OldRoom == r26)) SetRoom(r24, true);
|
||||
else if ((_curRoom == r2A) && (OldRoom == r25)) SetRoom(r2A, true);
|
||||
else if ((_curRoom == r2A) && ((OldRoom == r2B) || (OldRoom == r29) || (OldRoom == r29L))) SetRoom(r2A, false);
|
||||
else if ((_curRoom == r2B) && (OldRoom == r28)) SetRoom(r2B, true);
|
||||
else if ((_curRoom == r2B) && (OldRoom == r2A)) SetRoom(r2B, false);
|
||||
// for save/load
|
||||
else if ((_curRoom == r15) && (Room[_curRoom]._flag & OBJFLAG_EXTRA)) read3D("152.3d");
|
||||
else if ((_curRoom == r17) && (Room[_curRoom]._flag & OBJFLAG_EXTRA)) read3D("172.3d");
|
||||
else if ((_curRoom == r1D) && (Room[_curRoom]._flag & OBJFLAG_EXTRA)) read3D("1d2.3d");
|
||||
else if ((_curRoom == r21) && (Room[_curRoom]._flag & OBJFLAG_EXTRA)) read3D("212.3d");
|
||||
else if ((_curRoom == r24) && (Room[_curRoom]._flag & OBJFLAG_EXTRA)) read3D("242.3d");
|
||||
else if ((_curRoom == r28) && (Room[_curRoom]._flag & OBJFLAG_EXTRA)) read3D("282.3d");
|
||||
else if ((_curRoom == r2A) && (Room[_curRoom]._flag & OBJFLAG_EXTRA)) read3D("2A2.3d");
|
||||
else if ((_curRoom == r2B) && (Room[_curRoom]._flag & OBJFLAG_EXTRA)) read3D("2B2.3d");
|
||||
else if ((_curRoom == r2E) && (Room[_curRoom]._flag & OBJFLAG_EXTRA)) read3D("2E2.3d");
|
||||
else if ((_curRoom == r2GV) && (Room[_curRoom]._flag & OBJFLAG_EXTRA)) read3D("2GV2.3d");
|
||||
else if ((_curRoom == r35) && (Room[_curRoom]._flag & OBJFLAG_EXTRA)) read3D("352.3d");
|
||||
else if ((_curRoom == r37) && (Room[_curRoom]._flag & OBJFLAG_EXTRA)) read3D("372.3d");
|
||||
else if ((_curRoom == r4P) && (Room[_curRoom]._flag & OBJFLAG_EXTRA)) read3D("4P2.3d");
|
||||
// end save/load
|
||||
|
||||
setPosition(TheMessage->bparam);
|
||||
actorStop();
|
||||
|
||||
if (TheMessage->wparam2)
|
||||
StartCharacterAction(TheMessage->wparam2, 0, 0, 0);
|
||||
|
||||
AtEndChangeRoom();
|
||||
|
||||
Room[_curRoom]._flag |= OBJFLAG_DONE; // visitata
|
||||
drawCharacter(CALCPOINTS); // for right _actorPos entrance
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* DOSCROLLINVENTORY */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void doScrollInventory(uint16 mousex) {
|
||||
if ((_inventoryStatus == INV_PAINT) || (_inventoryStatus == INV_DEPAINT))
|
||||
return;
|
||||
|
||||
if ((mousex <= ICONMARGSX) && (TheIconBase))
|
||||
doEvent(MC_INVENTORY, ME_ONERIGHT, MP_DEFAULT, 0, 0, 0, 0);
|
||||
|
||||
else if (BETWEEN(SCREENLEN - ICONMARGDX, mousex, SCREENLEN) && (TheIconBase + ICONSHOWN < _inventorySize))
|
||||
doEvent(MC_INVENTORY, ME_ONELEFT, MP_DEFAULT, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* ROLLINVENTORY */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void RollInventory(uint8 status) {
|
||||
if (status == INV_PAINT) {
|
||||
_inventoryCounter -= InvSpeed[InvSpeedIndex++];
|
||||
if ((_inventoryCounter <= INVENTORY_SHOW) || (InvSpeedIndex > 5)) {
|
||||
InvSpeedIndex = 0;
|
||||
RegenInv(TheIconBase, INVENTORY_SHOW);
|
||||
_inventoryStatus = INV_INACTION;
|
||||
_inventoryCounter = INVENTORY_SHOW;
|
||||
if (!(INVAREA(my))) doEvent(MC_INVENTORY, ME_CLOSE, MP_DEFAULT, 0, 0, 0, 0);
|
||||
RepaintString();
|
||||
return ;
|
||||
}
|
||||
} else if (status == INV_DEPAINT) {
|
||||
_inventoryCounter += InvSpeed[InvSpeedIndex++];
|
||||
|
||||
if ((_inventoryCounter > INVENTORY_HIDE) || (InvSpeedIndex > 5)) {
|
||||
InvSpeedIndex = 0;
|
||||
RegenInv(TheIconBase, INVENTORY_HIDE);
|
||||
_inventoryStatus = INV_OFF;
|
||||
_inventoryCounter = INVENTORY_HIDE;
|
||||
if ((INVAREA(my)) && !(SemDialogActive || SemDialogMenuActive)) doEvent(MC_INVENTORY, ME_OPEN, MP_DEFAULT, 0, 0, 0, 0);
|
||||
else RepaintString();
|
||||
return ;
|
||||
}
|
||||
}
|
||||
RegenInv(TheIconBase, _inventoryCounter);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* DOIDLE */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void doIdle() {
|
||||
char c = GetKey();
|
||||
switch (c) {
|
||||
// Quit
|
||||
case 'q':
|
||||
case 'Q':
|
||||
if (!SemDialogActive && !SemDialogMenuActive) {
|
||||
if (QuitGame())
|
||||
doEvent(MC_SYSTEM, ME_QUIT, MP_SYSTEM, 0, 0, 0, 0);
|
||||
} else { //if( _curDialog == dINTRO )
|
||||
extern int FullEnd;
|
||||
extern uint16 _curAnimFrame[];
|
||||
|
||||
if (FullEnd != _curAnimFrame[1])
|
||||
FullEnd = _curAnimFrame[1] + 1;
|
||||
}
|
||||
break;
|
||||
|
||||
// Skip
|
||||
case 0x1B:
|
||||
if (SemDialogActive) {
|
||||
extern int FullEnd;
|
||||
extern uint16 _curAnimFrame[];
|
||||
|
||||
if (FullEnd != _curAnimFrame[1])
|
||||
FullEnd = _curAnimFrame[1] + 1;
|
||||
} else if (!SemSomeOneSpeak && !Semscriptactive && !SemDialogActive && !SemDialogMenuActive && (_actor._curAction < hWALKIN) && !SemUseWithStarted && _playingAnims[1] == 0 && SemShowHomo) {
|
||||
actorStop();
|
||||
nextStep();
|
||||
Mouse(1);
|
||||
SemMouseEnabled = true;
|
||||
_obj[o00EXIT]._goRoom = _curRoom;
|
||||
doEvent(MC_SYSTEM, ME_CHANGEROOM, MP_SYSTEM, rSYS, 0, 0, c);
|
||||
SemShowHomo = false;
|
||||
SemCharacterExist = false;
|
||||
IconSnapShot();
|
||||
}
|
||||
break;
|
||||
|
||||
// Sys
|
||||
case 0x3B:
|
||||
if (!SemSomeOneSpeak && !Semscriptactive && !SemDialogActive && !SemDialogMenuActive && (_actor._curAction < hWALKIN) && !SemUseWithStarted && _playingAnims[1] == 0 && SemShowHomo) {
|
||||
actorStop();
|
||||
nextStep();
|
||||
Mouse(1);
|
||||
SemMouseEnabled = true;
|
||||
_obj[o00EXIT]._goRoom = _curRoom;
|
||||
doEvent(MC_SYSTEM, ME_CHANGEROOM, MP_SYSTEM, rSYS, 0, 0, c);
|
||||
SemShowHomo = false;
|
||||
SemCharacterExist = false;
|
||||
IconSnapShot();
|
||||
}
|
||||
break;
|
||||
|
||||
// Save
|
||||
case 0x3C:
|
||||
if (!SemSomeOneSpeak && !Semscriptactive && !SemDialogActive && !SemDialogMenuActive && (_actor._curAction < hWALKIN) && !SemUseWithStarted && _playingAnims[1] == 0 && SemShowHomo) {
|
||||
IconSnapShot();
|
||||
SemSaveInventory = true;
|
||||
DataSave();
|
||||
ShowInvName(NO_OBJECTS, false);
|
||||
doEvent(MC_INVENTORY, ME_SHOWICONNAME, MP_DEFAULT, mx, my, 0, 0);
|
||||
RegenInventory(RegenInvStartIcon, RegenInvStartLine);
|
||||
}
|
||||
break;
|
||||
|
||||
// Load
|
||||
case 0x3D:
|
||||
if (!SemSomeOneSpeak && !Semscriptactive && !SemDialogActive && !SemDialogMenuActive && (_actor._curAction < hWALKIN) && !SemUseWithStarted && _playingAnims[1] == 0 && SemShowHomo) {
|
||||
IconSnapShot();
|
||||
if (!DataLoad()) {
|
||||
ShowInvName(NO_OBJECTS, false);
|
||||
doEvent(MC_INVENTORY, ME_SHOWICONNAME, MP_DEFAULT, mx, my, 0, 0);
|
||||
RegenInventory(RegenInvStartIcon, RegenInvStartLine);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (GAMEAREA(my))
|
||||
if ((_inventoryStatus == INV_ON) || (_inventoryStatus == INV_INACTION)) doEvent(MC_INVENTORY, ME_CLOSE, MP_SYSTEM, 0, 0, 0, 0);
|
||||
|
||||
if (ScrollInvTime > TheTime) ScrollInvTime = TheTime;
|
||||
if ((INVAREA(my)) && (TheTime > (INVSCROLLSP + ScrollInvTime))) {
|
||||
doScrollInventory(mx);
|
||||
ScrollInvTime = TheTime;
|
||||
}
|
||||
|
||||
if (ForceQuit && !SemDialogActive && !SemDialogMenuActive)
|
||||
doEvent(MC_SYSTEM, ME_QUIT, MP_SYSTEM, 0, 0, 0, 0);
|
||||
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
3369
engines/trecision/nl/define.h
Normal file
3369
engines/trecision/nl/define.h
Normal file
File diff suppressed because it is too large
Load Diff
686
engines/trecision/nl/dialog.cpp
Normal file
686
engines/trecision/nl/dialog.cpp
Normal file
@ -0,0 +1,686 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "trecision/nl/lib/addtype.h"
|
||||
#include "trecision/nl/sysdef.h"
|
||||
#include "trecision/nl/struct.h"
|
||||
#include "trecision/nl/ll/llinc.h"
|
||||
#include "trecision/nl/message.h"
|
||||
#include "trecision/nl/extern.h"
|
||||
#include "trecision/nl/define.h"
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
int EndBattuta = 0;
|
||||
uint16 DispScelte[MAXDISPSCELTE], CurDispScelte;
|
||||
int16 CurPos, LastPos;
|
||||
|
||||
/* -----------------28/07/97 22.11-------------------
|
||||
DialogPrint
|
||||
--------------------------------------------------*/
|
||||
void DialogPrint(int x, int y, int c, const char *txt) {
|
||||
struct SDText theChoice;
|
||||
|
||||
theChoice.x = x;
|
||||
theChoice.y = y;
|
||||
theChoice.dx = TextLength(txt, 0);
|
||||
theChoice.sign = txt;
|
||||
theChoice.l[0] = 0;
|
||||
theChoice.l[1] = 0;
|
||||
theChoice.l[2] = MAXX;
|
||||
theChoice.l[3] = MAXY;
|
||||
theChoice.tcol = c;
|
||||
theChoice.scol = MASKCOL;
|
||||
|
||||
DText(theChoice);
|
||||
}
|
||||
|
||||
/* -----------------28/07/97 22.11-------------------
|
||||
MostraScelte
|
||||
--------------------------------------------------*/
|
||||
void MostraScelte(uint16 i) {
|
||||
Dialog *d = &_dialog[i];
|
||||
|
||||
int y = 5;
|
||||
int x = 10;
|
||||
CurPos = -1;
|
||||
LastPos = -1;
|
||||
wordset(Video2, 0, MAXX * TOP);
|
||||
|
||||
for (int c = 0; c < MAXDISPSCELTE; c++)
|
||||
DispScelte[c] = 0;
|
||||
|
||||
CurDispScelte = 0;
|
||||
for (int c = d->_firstChoice; c < (d->_firstChoice + d->_choiceNumb); c++) {
|
||||
if (!(_choice[c]._flag & DLGCHOICE_HIDE)) {
|
||||
DispScelte[CurDispScelte++] = c;
|
||||
DialogPrint(x, y, HWHITE, Sentence[_choice[c]._sentenceIndex]);
|
||||
y += CARHEI;
|
||||
}
|
||||
}
|
||||
|
||||
ShowScreen(0, 0, MAXX, TOP);
|
||||
|
||||
SemDialogMenuActive = true;
|
||||
SemMouseEnabled = true;
|
||||
}
|
||||
|
||||
/* -----------------28/07/97 22.12-------------------
|
||||
UpdateScelte
|
||||
--------------------------------------------------*/
|
||||
void UpdateScelte(int16 dmx, int16 dmy) {
|
||||
if ((dmy >= MAXDISPSCELTE) && (dmy < (CARHEI * (CurDispScelte) + 5)))
|
||||
CurPos = (dmy - 5) / CARHEI;
|
||||
else
|
||||
CurPos = -1;
|
||||
|
||||
if ((CurPos != LastPos) && ((CurPos != -1) || (LastPos != -1))) {
|
||||
for (int c = 0; c < MAXDISPSCELTE; c++) {
|
||||
if (DispScelte[c] != 0) {
|
||||
if (c == CurPos)
|
||||
DialogPrint(10, 5 + c * CARHEI, HGREEN, Sentence[_choice[DispScelte[c]]._sentenceIndex]);
|
||||
else
|
||||
DialogPrint(10, 5 + c * CARHEI, HWHITE, Sentence[_choice[DispScelte[c]]._sentenceIndex]);
|
||||
}
|
||||
}
|
||||
ShowScreen(0, 5, MAXX, (CurDispScelte)*CARHEI + 5);
|
||||
}
|
||||
LastPos = CurPos;
|
||||
}
|
||||
|
||||
/* -----------------28/07/97 22.12-------------------
|
||||
ScegliScelta
|
||||
--------------------------------------------------*/
|
||||
void ScegliScelta(int16 dmx, int16 dmy) {
|
||||
UpdateScelte(dmx, dmy);
|
||||
|
||||
if (CurPos != -1) {
|
||||
SemDialogMenuActive = false;
|
||||
|
||||
PlayScelta(DispScelte[CurPos]);
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------28/07/97 22.08-------------------
|
||||
PlayDialog
|
||||
--------------------------------------------------*/
|
||||
void PlayDialog(uint16 i) {
|
||||
_curDialog = i;
|
||||
SemDialogActive = true;
|
||||
_curChoice = 0;
|
||||
_curSubTitle = 0;
|
||||
SemShowHomo = false; // prima non c'era
|
||||
|
||||
InitQueue(&Homo);
|
||||
_inventoryStatus = INV_OFF;
|
||||
_inventoryCounter = INVENTORY_HIDE;
|
||||
ClearText();
|
||||
PaintString();
|
||||
PaintScreen(1);
|
||||
|
||||
wordset(Video2, 0, MAXX * TOP);
|
||||
ShowScreen(0, 0, MAXX, TOP);
|
||||
|
||||
// sprintf( UStr, "%sFMV\\%s", GamePath, _dialog[i]._startAnim );
|
||||
// sprintf( UStr, "FMV\\%s", _dialog[i]._startAnim );
|
||||
StartFullMotion((const char *)_dialog[i]._startAnim);
|
||||
|
||||
int skip = 0;
|
||||
int curChoice = 0;
|
||||
for (int c = _dialog[_curDialog]._firstChoice; c < (_dialog[_curDialog]._firstChoice + _dialog[_curDialog]._choiceNumb); c++)
|
||||
if (!(_choice[c]._flag & DLGCHOICE_HIDE))
|
||||
curChoice++;
|
||||
|
||||
if ((_curDialog == dC581) && !(_choice[262]._flag & DLGCHOICE_HIDE))
|
||||
skip++;
|
||||
if ((_curDialog == dC581) && (curChoice == 1))
|
||||
skip++;
|
||||
if ((_curDialog == dNEGOZIANTE1A) && (curChoice == 1))
|
||||
skip++;
|
||||
// se c'e' predialog
|
||||
if ((_dialog[i]._startLen > 0) && !(skip))
|
||||
PlayFullMotion(1, _dialog[i]._startLen);
|
||||
else {
|
||||
CallSmackSoundOnOff(1, 0);
|
||||
afterChoice(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------28/07/97 22.08-------------------
|
||||
afterChoice
|
||||
--------------------------------------------------*/
|
||||
void afterChoice(int numframe) {
|
||||
extern short SFxVol;
|
||||
Dialog *d = &_dialog[_curDialog];
|
||||
|
||||
wordset(Video2, 0, MAXX * TOP);
|
||||
ShowScreen(0, 0, MAXX, TOP);
|
||||
|
||||
switch (_curDialog) {
|
||||
case dBARBONE171:
|
||||
if (_curChoice == 80) {
|
||||
_obj[ocBARBONE17]._action = 213;
|
||||
_obj[ocBARBONE17]._flag &= ~OBJFLAG_PERSON;
|
||||
} else if (_curChoice == 77) {
|
||||
_obj[ocBARBONE17]._action = 211;
|
||||
_obj[ocBARBONE17]._flag &= ~OBJFLAG_PERSON;
|
||||
}
|
||||
break;
|
||||
|
||||
case dBARBONE1714:
|
||||
if (_curChoice == 106) {
|
||||
_obj[ocBARBONE17]._action = 213;
|
||||
_obj[ocBARBONE17]._flag &= ~OBJFLAG_PERSON;
|
||||
}
|
||||
break;
|
||||
|
||||
case dBARBONE1713:
|
||||
if (_curChoice == 91) {
|
||||
_obj[ocBARBONE17]._action = 212;
|
||||
_obj[ocBARBONE17]._flag &= ~OBJFLAG_PERSON;
|
||||
}
|
||||
break;
|
||||
|
||||
case dBARBONE1716:
|
||||
if (_curChoice == 122) {
|
||||
_obj[ocBARBONE17]._action = 212;
|
||||
_obj[ocBARBONE17]._flag &= ~OBJFLAG_PERSON;
|
||||
}
|
||||
break;
|
||||
|
||||
case dBARBONE1717:
|
||||
if (_curChoice == 136) {
|
||||
_obj[ocBARBONE17]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[oBARBONED17]._mode |= OBJMODE_OBJSTATUS;
|
||||
Room[r17]._bkgAnim = aBKG17B;
|
||||
AddIcon(iPATTINO);
|
||||
} else if (_curChoice == 137) {
|
||||
_obj[ocBARBONE17]._flag |= OBJFLAG_PERSON;
|
||||
}
|
||||
break;
|
||||
|
||||
case dGUARDIANO18:
|
||||
if ((_curChoice == 151) || (_curChoice == 152)) {
|
||||
InvObj[iFOTO]._action = 1465;
|
||||
_obj[oTESSERA1A]._action = 238;
|
||||
if (_obj[oTESSERA1A]._flag & OBJFLAG_EXTRA) {
|
||||
_choice[154]._flag &= ~DLGCHOICE_HIDE;
|
||||
_choice[153]._flag |= DLGCHOICE_HIDE;
|
||||
} else
|
||||
_choice[153]._flag &= ~DLGCHOICE_HIDE;
|
||||
} else if (_curChoice == 154) {
|
||||
if (_obj[oTESSERA1A]._flag & OBJFLAG_EXTRA)
|
||||
_choice[183]._flag &= ~DLGCHOICE_HIDE;
|
||||
} else if (_curChoice == 155)
|
||||
_obj[ocGUARDIANO18]._action = 228;
|
||||
break;
|
||||
|
||||
/* case dSAM17:
|
||||
if( ( _curChoice == 198 ) && ( _curRoom == r17 ) )
|
||||
setPosition(4);
|
||||
break;
|
||||
*/
|
||||
case dF213B:
|
||||
case dF213:
|
||||
SetRoom(r21, true);
|
||||
break;
|
||||
|
||||
case dF212B:
|
||||
case dF212:
|
||||
SetRoom(r21, false);
|
||||
break;
|
||||
|
||||
case dF321:
|
||||
KillIcon(iTORCIA32);
|
||||
SemShowHomo = false;
|
||||
break;
|
||||
|
||||
case dF4A3:
|
||||
_obj[oCIOCCOLATINI4A]._examine = 1105;
|
||||
_obj[oCIOCCOLATINI4A]._action = 1106;
|
||||
_obj[oPORTAC4A]._action = 1118;
|
||||
AnimTab[aBKG4A].flag |= SMKANIM_OFF1;
|
||||
_obj[ocHELLEN4A]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[oHELLENA4A]._mode |= OBJMODE_OBJSTATUS;
|
||||
break;
|
||||
|
||||
case dC581:
|
||||
_obj[oFINESTRAB58]._mode |= OBJMODE_OBJSTATUS;
|
||||
if (_curChoice == 262)
|
||||
_obj[oTASTIERA56]._examine = 1307;
|
||||
break;
|
||||
|
||||
case dF542:
|
||||
_obj[oGRATAC54]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[oPORTAC54]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[oLAVATRICEL54]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[oLAVATRICEF54]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[oGRATAA54]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[oCHIAVI54]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[od54ALLA55]._mode |= OBJMODE_OBJSTATUS;
|
||||
break;
|
||||
}
|
||||
// Se ultima scelta era un esci dialogo
|
||||
if (_choice[_curChoice]._flag & DLGCHOICE_EXITDLG) {
|
||||
StopFullMotion();
|
||||
|
||||
switch (_curDialog) {
|
||||
/* case dASCENSORE12:
|
||||
if( _curChoice == 3 )
|
||||
StartCharacterAction(a129PARLACOMPUTERESCENDE,r13,20,0);
|
||||
else if( _curChoice == 4 )
|
||||
StartCharacterAction(a129PARLACOMPUTERESCENDE,r16,20,0);
|
||||
break;
|
||||
|
||||
case dASCENSORE13:
|
||||
if( _curChoice == 17 )
|
||||
StartCharacterAction(a139CHIUDONOPORTESU,r12,20,0);
|
||||
else if( _curChoice == 18 )
|
||||
StartCharacterAction(a1316CHIUDONOPORTEGIU,r16,20,0);
|
||||
break;
|
||||
|
||||
case dASCENSORE16:
|
||||
if( _curChoice == 32 )
|
||||
StartCharacterAction(a1616SALECONASCENSORE,r12,20,0);
|
||||
else if( _curChoice == 33 )
|
||||
StartCharacterAction(a1616SALECONASCENSORE,r13,20,0);
|
||||
break;
|
||||
*/
|
||||
case dPOLIZIOTTO16:
|
||||
if ((_choice[61]._flag & OBJFLAG_DONE) && (_choice[62]._flag & OBJFLAG_DONE) && (_obj[ocPOLIZIOTTO16]._flag & OBJFLAG_EXTRA))
|
||||
_obj[ocPOLIZIOTTO16]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
break;
|
||||
|
||||
case dBARBONE171:
|
||||
if (_curChoice == 77) {
|
||||
_obj[ocBARBONE17]._action = 211;
|
||||
_obj[ocBARBONE17]._flag &= ~OBJFLAG_PERSON;
|
||||
} else if (_curChoice == 80)
|
||||
_obj[ocBARBONE17]._action = 213;
|
||||
else if (_curChoice == 122)
|
||||
_obj[ocBARBONE17]._action = 211;
|
||||
break;
|
||||
|
||||
case dGUARDIANO18:
|
||||
if (_curChoice == 152)
|
||||
_obj[ocGUARDIANO18]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
else if (_curChoice == 155)
|
||||
StartCharacterAction(a184ENTRACLUB, r19, 2, 0);
|
||||
break;
|
||||
|
||||
case dEVA19:
|
||||
_obj[oPORTAC18]._flag &= ~OBJFLAG_ROOMOUT;
|
||||
_obj[oPORTAC18]._action = 221;
|
||||
_obj[ocEVA19]._action = 1999;
|
||||
_obj[ocEVA19]._flag &= ~OBJFLAG_PERSON;
|
||||
break;
|
||||
|
||||
case dNEGOZIANTE1A:
|
||||
if (_curChoice == 185) {
|
||||
doEvent(MC_SYSTEM, ME_CHANGEROOM, MP_SYSTEM, r18, a1810ENTRADALNEGOZIO, 10, _curObj);
|
||||
_obj[oPORTAN18]._flag &= ~OBJFLAG_ROOMOUT;
|
||||
_obj[oPORTAN18]._action = 218;
|
||||
_obj[oPORTAN18]._anim = 0;
|
||||
} else if (_curChoice == 183)
|
||||
_obj[oTESSERA1A]._action = 239;
|
||||
break;
|
||||
|
||||
case dF181:
|
||||
_obj[oRETE17]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[oPORTAA17]._examine = 196;
|
||||
_obj[oPORTAUA17]._examine = 187;
|
||||
_obj[oPORTAUB17]._examine = 192;
|
||||
_obj[oPORTAA17]._action = 188;
|
||||
_obj[oPORTAUA17]._action = 193;
|
||||
_obj[oPORTAUB17]._action = 197;
|
||||
_obj[oFINGERPAD17]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
Room[r17]._flag &= ~OBJFLAG_DONE;
|
||||
Room[r17]._flag |= OBJFLAG_EXTRA;
|
||||
break;
|
||||
|
||||
case dF1C1:
|
||||
CharacterSay(334);
|
||||
break;
|
||||
|
||||
case dF1D1:
|
||||
CharacterSay(1502);
|
||||
break;
|
||||
|
||||
case dF2E1:
|
||||
CharacterSay(621);
|
||||
_obj[oCATWALKA2E]._action = 622;
|
||||
break;
|
||||
|
||||
case dF2E2:
|
||||
CharacterSay(1561);
|
||||
InvObj[iFUCILE]._examine = 1562;
|
||||
break;
|
||||
|
||||
case dF231:
|
||||
_obj[od21ALLA23]._goRoom = r23B;
|
||||
_obj[od24ALLA23]._goRoom = r23B;
|
||||
break;
|
||||
|
||||
case dF291:
|
||||
_obj[oINTERRUTTORE29]._action = 479;
|
||||
_obj[od22ALLA29]._goRoom = r29L;
|
||||
_obj[od2AALLA29]._goRoom = r29L;
|
||||
_obj[od22ALLA29]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[od22ALLA29I]._mode |= OBJMODE_OBJSTATUS;
|
||||
break;
|
||||
|
||||
case dF2G1:
|
||||
_obj[oPANNELLOM2G]._action = 660;
|
||||
CharacterSay(659);
|
||||
break;
|
||||
|
||||
case dF2G2:
|
||||
_obj[od26ALLA2G]._goRoom = r2GV;
|
||||
ReplaceIcon(iSAM, iSAMROTTO);
|
||||
break;
|
||||
|
||||
case dF321:
|
||||
StartCharacterAction(a3111TRASCINA, 0, 11, 0);
|
||||
break;
|
||||
|
||||
case dF331:
|
||||
_obj[oTUBOT33]._lim[0] = 0;
|
||||
_obj[oTUBOT33]._lim[1] = 0;
|
||||
_obj[oTUBOT33]._lim[2] = 0;
|
||||
_obj[oTUBOT33]._lim[3] = 0;
|
||||
CharacterSay(1997);
|
||||
break;
|
||||
|
||||
case dF362:
|
||||
PlayDialog(dC381);
|
||||
break;
|
||||
|
||||
case dC381:
|
||||
PlayDialog(dF381);
|
||||
break;
|
||||
|
||||
case dF381:
|
||||
doEvent(MC_SYSTEM, ME_CHANGEROOM, MP_SYSTEM, r41, 0, 18, _curObj);
|
||||
memcpy(_cyberInventory, _inventory, MAXICON);
|
||||
_cyberInventorySize = _inventorySize;
|
||||
_inventorySize = 0;
|
||||
TheIconBase = 0;
|
||||
memset(_inventory, iNULL, MAXICON);
|
||||
_inventory[_inventorySize++] = iDISLOCATORE;
|
||||
break;
|
||||
|
||||
case dF371:
|
||||
_obj[oSCAFFALE36]._anim = a3615AAPRENDESCAFFALE;
|
||||
CallSmackVolumePan(0, 1, (32768 * 2 * SFxVol) / 125);
|
||||
break;
|
||||
|
||||
case dF431:
|
||||
SemShowHomo = true;
|
||||
StartCharacterAction(aWALKIN, 0, 11, 0);
|
||||
break;
|
||||
|
||||
case dF451:
|
||||
_obj[od44ALLA45]._goRoom = r45S;
|
||||
CharacterSay(1712);
|
||||
break;
|
||||
|
||||
case dF491:
|
||||
for (int c = oPULSANTE1AD; c <= oPULSANTE33AD; c++) {
|
||||
if (!(_obj[c]._goRoom)) {
|
||||
_obj[c]._goRoom = r4A;
|
||||
_obj[c]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[c - 40]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
KillIcon(iASTA);
|
||||
PlayDialog(dC4A1);
|
||||
setPosition(12);
|
||||
break;
|
||||
|
||||
case dC4A1:
|
||||
SemCharacterExist = true;
|
||||
SemShowHomo = true;
|
||||
actorStop();
|
||||
nextStep();
|
||||
break;
|
||||
|
||||
case dF4C1:
|
||||
memcpy(_inventory, _cyberInventory, MAXICON);
|
||||
_inventorySize = _cyberInventorySize;
|
||||
TheIconBase = 0;
|
||||
KillIcon(iCARD03);
|
||||
KillIcon(iPEN);
|
||||
KillIcon(iKEY05);
|
||||
KillIcon(iLETTERA12);
|
||||
KillIcon(iCARD14);
|
||||
KillIcon(iFOTO);
|
||||
KillIcon(iPISTOLA15);
|
||||
KillIcon(iRAPPORTO);
|
||||
KillIcon(iTESSERA);
|
||||
KillIcon(iFUCILE);
|
||||
KillIcon(iLAMPADINA29);
|
||||
KillIcon(iTELECOMANDO2G);
|
||||
KillIcon(iCARD36);
|
||||
KillIcon(iFOGLIO36);
|
||||
KillIcon(iSTETOSCOPIO);
|
||||
KillIcon(iREFERTO);
|
||||
KillIcon(iLIBRO);
|
||||
AddIcon(iMAPPA50);
|
||||
AddIcon(iCUTTER);
|
||||
AddIcon(iWALKY);
|
||||
StartCharacterAction(a511, 0, 1, 0);
|
||||
break;
|
||||
|
||||
case dF4P1:
|
||||
CharacterSay(1707);
|
||||
break;
|
||||
|
||||
case dF4P2:
|
||||
CharacterSay(1708);
|
||||
break;
|
||||
|
||||
case dF562:
|
||||
_obj[oPORTA58C55]._action = 1287;
|
||||
_obj[oPORTA58C55]._anim = 0;
|
||||
_obj[oFINESTRA58P55]._action = 1292;
|
||||
_obj[oFINESTRA58P55]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[oFINESTRA58P55]._anim = 0;
|
||||
break;
|
||||
|
||||
case dF5A1:
|
||||
_obj[oPORTA58C55]._action = 1286;
|
||||
_obj[oFINESTRA58P55]._action = 1291;
|
||||
_obj[oFINESTRAA5A]._action = 1403;
|
||||
_obj[oGUARDIA58]._mode |= OBJMODE_OBJSTATUS;
|
||||
_choice[286]._flag |= OBJFLAG_DONE;
|
||||
break;
|
||||
|
||||
case dC581:
|
||||
if (!(_choice[886]._flag & OBJFLAG_DONE) && (_choice[258]._flag & OBJFLAG_DONE)) {
|
||||
setPosition(1);
|
||||
PlayDialog(dF581);
|
||||
}
|
||||
break;
|
||||
|
||||
case dC582:
|
||||
_obj[oFINESTRAA58]._mode |= OBJMODE_OBJSTATUS;
|
||||
AddIcon(iCODICE);
|
||||
break;
|
||||
|
||||
case dC5A1:
|
||||
_obj[oFINESTRAA5A]._action = 1402;
|
||||
if (Room[r5A]._flag & OBJFLAG_EXTRA)
|
||||
PlayDialog(dF5A1);
|
||||
break;
|
||||
|
||||
case dFLOG:
|
||||
PlayDialog(dINTRO);
|
||||
break;
|
||||
|
||||
case dINTRO:
|
||||
doEvent(MC_SYSTEM, ME_CHANGEROOM, MP_SYSTEM, r11, 0, 20, _curObj);
|
||||
break;
|
||||
|
||||
case dF582:
|
||||
PlayDialog(dFCRED);
|
||||
break;
|
||||
|
||||
case dFCRED:
|
||||
doEvent(MC_SYSTEM, ME_QUIT, MP_SYSTEM, 0, 0, 0, 0);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// se parte altro dialogo
|
||||
if (_choice[_curChoice]._nextDialog != 0) {
|
||||
extern int FullStart, FullEnd;
|
||||
|
||||
_curDialog = _choice[_curChoice]._nextDialog;
|
||||
SemDialogActive = true;
|
||||
_curChoice = 0;
|
||||
|
||||
d = &_dialog[_curDialog];
|
||||
|
||||
FullStart = 0;
|
||||
FullEnd = 0;
|
||||
|
||||
// se c'e' predialog
|
||||
if (_dialog[_curDialog]._startLen > 0) {
|
||||
PlayFullMotion(1, _dialog[_curDialog]._startLen);
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
// fa partire subito tutte le prevarica
|
||||
for (int c = d->_firstChoice; c < (d->_firstChoice + d->_choiceNumb); c++) {
|
||||
if ((_choice[c]._flag & DLGCHOICE_FRAUD) && (!(_choice[c]._flag & DLGCHOICE_HIDE))) {
|
||||
PlayScelta(c);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// se c'e' una sola partisubito la fa partire altrimenti mostra le scelte
|
||||
int res = 0;
|
||||
for (int c = d->_firstChoice; c < (d->_firstChoice + d->_choiceNumb); c++) {
|
||||
if (!(_choice[c]._flag & DLGCHOICE_HIDE)) {
|
||||
if (_choice[c]._flag & DLGCHOICE_EXITNOW) {
|
||||
if (res == 0)
|
||||
res = c;
|
||||
else {
|
||||
res = 0;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
res = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (res != 0) {
|
||||
PlayScelta(res);
|
||||
return;
|
||||
}
|
||||
|
||||
// se sono tutte hidate esce dal dialogo
|
||||
res = 0;
|
||||
for (int c = d->_firstChoice; c < (d->_firstChoice + d->_choiceNumb); c++) {
|
||||
if (!(_choice[c]._flag & DLGCHOICE_HIDE))
|
||||
res++;
|
||||
}
|
||||
|
||||
if (res == 0) {
|
||||
StopFullMotion();
|
||||
if (_curDialog == dC381)
|
||||
PlayDialog(dF381);
|
||||
return;
|
||||
}
|
||||
|
||||
MostraScelte(_curDialog);
|
||||
}
|
||||
|
||||
/* -----------------28/07/97 22.08-------------------
|
||||
DialogHandler
|
||||
--------------------------------------------------*/
|
||||
void DialogHandler(int numframe) {
|
||||
if ((SemDialogActive) && (!(SemDialogMenuActive))) {
|
||||
SemMouseEnabled = false;
|
||||
if (numframe == _subTitles[_curSubTitle]._startFrame) {
|
||||
int i = _curSubTitle++;
|
||||
BattutaPrint(_subTitles[i]._x, _subTitles[i]._y, _subTitles[i]._color, Sentence[_subTitles[i]._sentence]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------28/07/97 22.11-------------------
|
||||
PlayScelta
|
||||
--------------------------------------------------*/
|
||||
void PlayScelta(uint16 i) {
|
||||
DialogChoice *ss = &_choice[i];
|
||||
|
||||
wordset(Video2, 0, MAXX * TOP);
|
||||
ShowScreen(0, 0, MAXX, TOP);
|
||||
|
||||
_curChoice = i;
|
||||
_curSubTitle = ss->_firstSubTitle;
|
||||
EndBattuta = (ss->_firstSubTitle + ss->_subTitleNumb);
|
||||
SemDialogMenuActive = false;
|
||||
|
||||
ss->_flag |= OBJFLAG_DONE;
|
||||
|
||||
// se era one time la disabilita
|
||||
if (ss->_flag & DLGCHOICE_ONETIME)
|
||||
ss->_flag |= DLGCHOICE_HIDE;
|
||||
|
||||
// disattiva le altre scelte
|
||||
for (int c = 0; c < MAXDISPSCELTE; c++)
|
||||
_choice[ss->_off[c]]._flag |= DLGCHOICE_HIDE;
|
||||
// attiva le altre scelte
|
||||
for (int c = 0; c < MAXDISPSCELTE; c++)
|
||||
_choice[ss->_on[c]]._flag &= ~DLGCHOICE_HIDE;
|
||||
|
||||
int lens = 0;
|
||||
for (int c = _curSubTitle; c < EndBattuta; c++)
|
||||
lens += _subTitles[c]._length;
|
||||
|
||||
SemMouseEnabled = false;
|
||||
PlayFullMotion(ss->_startFrame, ss->_startFrame + lens - 1);
|
||||
}
|
||||
|
||||
/* -----------------28/07/97 22.15-------------------
|
||||
DoDialog
|
||||
--------------------------------------------------*/
|
||||
void doDialog() {
|
||||
switch (TheMessage->event) {
|
||||
case ME_ENDSCELTA:
|
||||
afterChoice(TheMessage->wparam1);
|
||||
break;
|
||||
|
||||
case ME_STARTDIALOG:
|
||||
PlayDialog(TheMessage->wparam1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
4266
engines/trecision/nl/do.cpp
Normal file
4266
engines/trecision/nl/do.cpp
Normal file
File diff suppressed because it is too large
Load Diff
163
engines/trecision/nl/extern.h
Normal file
163
engines/trecision/nl/extern.h
Normal file
@ -0,0 +1,163 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "proto.h"
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* INIT */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
extern struct SRoom Room[];
|
||||
extern struct SObject _obj[];
|
||||
extern struct SInvObject InvObj[];
|
||||
extern struct SSound GSample[];
|
||||
extern struct SAnim AnimTab[];
|
||||
|
||||
extern uint8 _actionLen[];
|
||||
|
||||
extern const char *ObjName[];
|
||||
extern const char *Sentence[];
|
||||
extern const char *_sysSent[];
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* MESSY SYSTEM */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
extern message GameMessage[];
|
||||
extern message HomoMessage[];
|
||||
extern message AnimMessage[];
|
||||
|
||||
extern message idlemessage;
|
||||
extern message quitgamemessage;
|
||||
extern message supereventmessage;
|
||||
|
||||
extern message *TheMessage;
|
||||
|
||||
extern LLBOOL SuperEventActivate;
|
||||
|
||||
extern pqueue Game;
|
||||
extern pqueue Anim;
|
||||
extern pqueue Homo;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* SCRIPT */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
extern struct SScriptFrame ScriptFrame[];
|
||||
extern struct SScript Script[];
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* VARIABILI ATTUALI */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
extern uint16 _curRoom;
|
||||
extern uint16 OldRoom;
|
||||
|
||||
extern uint16 _curObj;
|
||||
extern uint16 CurInventory;
|
||||
extern int32 CurSortTableNum;
|
||||
extern uint16 CurScriptFrame[];
|
||||
|
||||
extern int8 _homoInMovement;
|
||||
extern int8 _homoGoToPosition;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* VARIABILI DI SERVIZIO */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
extern int8 OldObjStatus[];
|
||||
extern int8 VideoObjStatus[];
|
||||
|
||||
extern struct screenrect VideoTop;
|
||||
extern struct screenrect VideoCent;
|
||||
extern struct screenrect VideoBott;
|
||||
|
||||
extern struct SSortTable SortTable[];
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* FLAGS DI STATO */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
extern LLBOOL Semscriptactive;
|
||||
extern LLBOOL SemDialogActive;
|
||||
extern LLBOOL SemDialogMenuActive;
|
||||
extern LLBOOL Semskiptalk;
|
||||
extern LLBOOL Semskipenable;
|
||||
extern LLBOOL SemMouseEnabled;
|
||||
extern LLBOOL SemScreenRefreshed;
|
||||
extern LLBOOL SemPaintHomo;
|
||||
extern LLBOOL SemShowHomo;
|
||||
extern LLBOOL SemSomeOneSpeak;
|
||||
extern LLBOOL SemCharacterSpeak;
|
||||
extern LLBOOL SemInventoryLocked;
|
||||
extern LLBOOL SemUseWithStarted;
|
||||
extern LLBOOL SemUseWithLocked;
|
||||
extern LLBOOL SemMousePolling;
|
||||
extern LLBOOL SemDialogSolitaire;
|
||||
extern LLBOOL SemCharacterExist;
|
||||
extern LLBOOL SemWalkNoInterrupt;
|
||||
extern LLBOOL SemNoPaintScreen;
|
||||
extern LLBOOL SemForceRegenInventory;
|
||||
extern LLBOOL SemWaitRegen;
|
||||
|
||||
extern LLBOOL SemSaveInventory;
|
||||
extern LLBOOL SemLoadInventory;
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* Inventory */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
extern uint8 _inventory[];
|
||||
extern uint8 _inventorySize;
|
||||
extern uint8 _cyberInventory[];
|
||||
extern uint8 _cyberInventorySize;
|
||||
extern uint8 TheIconBase;
|
||||
extern uint8 _inventoryStatus;
|
||||
extern uint8 LightIcon;
|
||||
extern uint8 RegenInvStartIcon;
|
||||
extern uint8 RegenInvStartLine;
|
||||
extern uint16 _lastCurInventory;
|
||||
extern uint16 _lastLightIcon;
|
||||
extern int16 _inventoryCounter;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* USACON */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
extern uint16 UseWith[];
|
||||
extern LLBOOL UseWithInv[];
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* VARIE */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
extern uint32 TheTime;
|
||||
extern int16 mx, my, mleft, mright;
|
||||
extern uint32 OldTime;
|
||||
extern uint32 CharacterSpeakTime;
|
||||
extern uint32 SomeOneSpeakTime;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* DIALOGHI */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
extern Dialog _dialog[];
|
||||
extern DialogChoice _choice [];
|
||||
extern DialogSubTitle _subTitles[];
|
||||
|
||||
extern char *dScelta [];
|
||||
extern char *dBattuta[];
|
||||
|
||||
extern uint16 _curDialog, _curChoice, _curSubTitle;
|
||||
|
||||
} // End of namespace Trecision
|
164
engines/trecision/nl/globvar.cpp
Normal file
164
engines/trecision/nl/globvar.cpp
Normal file
@ -0,0 +1,164 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "trecision/nl/lib/addtype.h"
|
||||
#include "trecision/nl/sysdef.h"
|
||||
#include "trecision/nl/struct.h"
|
||||
#include "trecision/nl/message.h"
|
||||
#include "trecision/nl/extern.h"
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* INIT */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
struct SRoom Room[MAXROOMS];
|
||||
struct SObject _obj[MAXOBJ];
|
||||
struct SInvObject InvObj[MAXINVENTORY];
|
||||
struct SSound GSample[MAXSAMPLE];
|
||||
struct SAnim AnimTab[MAXANIM];
|
||||
|
||||
uint8 _actionLen[MAXACTION];
|
||||
|
||||
const char *ObjName[MAXOBJNAME];
|
||||
const char *Sentence[MAXSENTENCE];
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* MESSY SYSTEM */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
message GameMessage[MAXMESSAGE];
|
||||
message HomoMessage[MAXMESSAGE];
|
||||
message AnimMessage[MAXMESSAGE];
|
||||
|
||||
message idlemessage = {MC_IDLE, 0, MP_DEFAULT, 0, 0, 0, 0, 0};
|
||||
message quitgamemessage = {MC_SYSTEM, ME_QUIT, MP_SYSTEM, 0, 0, 0, 0, 0};
|
||||
message supereventmessage;
|
||||
|
||||
message *TheMessage;
|
||||
|
||||
LLBOOL SuperEventActivate;
|
||||
|
||||
pqueue Game;
|
||||
pqueue Anim;
|
||||
pqueue Homo;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* SCRIPT */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
struct SScriptFrame ScriptFrame[MAXSCRIPTFRAME];
|
||||
struct SScript Script[MAXSCRIPT];
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* VARIABILI ATTUALI */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
uint16 _curRoom;
|
||||
uint16 OldRoom;
|
||||
|
||||
uint16 _curObj = 1;
|
||||
uint16 CurInventory;
|
||||
int32 CurSortTableNum;
|
||||
uint16 CurScriptFrame[10];
|
||||
|
||||
int8 _homoInMovement = false;
|
||||
int8 _homoGoToPosition = -1;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* VARIABILI DI SERVIZIO */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
int8 OldObjStatus[MAXOBJINROOM];
|
||||
int8 VideoObjStatus[MAXOBJINROOM];
|
||||
|
||||
struct screenrect VideoTop = { 0, 0, 0, TOP - 1};
|
||||
struct screenrect VideoCent = { 0, TOP, 639, (TOP + AREA) - 1};
|
||||
struct screenrect VideoBott = { 0, (TOP + AREA), 639, 479};
|
||||
|
||||
struct SSortTable SortTable[200];
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* FLAGS DI STATO */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
LLBOOL Semscriptactive;
|
||||
LLBOOL SemDialogActive;
|
||||
LLBOOL SemDialogMenuActive;
|
||||
LLBOOL Semskiptalk;
|
||||
LLBOOL Semskipenable;
|
||||
LLBOOL SemMouseEnabled = true;
|
||||
LLBOOL SemScreenRefreshed;
|
||||
LLBOOL SemPaintHomo;
|
||||
LLBOOL SemShowHomo = 1;
|
||||
LLBOOL SemSomeOneSpeak;
|
||||
LLBOOL SemCharacterSpeak;
|
||||
LLBOOL SemInventoryLocked;
|
||||
LLBOOL SemUseWithStarted;
|
||||
LLBOOL SemUseWithLocked;
|
||||
LLBOOL SemMousePolling;
|
||||
LLBOOL SemDialogSolitaire;
|
||||
LLBOOL SemCharacterExist = true;
|
||||
LLBOOL SemWalkNoInterrupt;
|
||||
LLBOOL SemNoPaintScreen;
|
||||
LLBOOL SemForceRegenInventory;
|
||||
LLBOOL SemWaitRegen;
|
||||
|
||||
LLBOOL SemSaveInventory;
|
||||
LLBOOL SemLoadInventory;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* Inventory */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
uint8 _inventory[MAXICON];
|
||||
uint8 _inventorySize;
|
||||
uint8 _cyberInventory[MAXICON];
|
||||
uint8 _cyberInventorySize;
|
||||
uint8 TheIconBase;
|
||||
uint8 _inventoryStatus = INV_OFF;
|
||||
uint8 LightIcon = 0xFF;
|
||||
uint8 RegenInvStartIcon;
|
||||
uint8 RegenInvStartLine = INVENTORY_HIDE;
|
||||
uint16 _lastCurInventory;
|
||||
uint16 _lastLightIcon = 0xFF;
|
||||
int16 _inventoryCounter = INVENTORY_HIDE;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* USACON */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
uint16 UseWith[2];
|
||||
LLBOOL UseWithInv[2];
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* VARIE */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
uint32 TheTime;
|
||||
int16 mx, my, mleft, mright;
|
||||
uint32 OldTime;
|
||||
uint32 CharacterSpeakTime;
|
||||
uint32 SomeOneSpeakTime;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* DIALOGHI */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
Dialog _dialog[MAXDIALOG];
|
||||
DialogChoice _choice [MAXCHOICE];
|
||||
DialogSubTitle _subTitles[MAXSUBTITLES];
|
||||
|
||||
uint16 _curDialog, _curChoice, _curSubTitle;
|
||||
|
||||
} // End of namespace Trecision
|
87
engines/trecision/nl/initmain.cpp
Normal file
87
engines/trecision/nl/initmain.cpp
Normal file
@ -0,0 +1,87 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <io.h>
|
||||
#include <ctype.h>
|
||||
#include "trecision/nl/lib/addtype.h"
|
||||
#include "trecision/nl/sysdef.h"
|
||||
#include "trecision/nl/struct.h"
|
||||
#include "trecision/nl/define.h"
|
||||
#include "trecision/nl/message.h"
|
||||
#include "trecision/nl/extern.h"
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
/*-----------------03/01/97 16.15-------------------
|
||||
InitMain
|
||||
--------------------------------------------------*/
|
||||
void initMain() {
|
||||
for (int c = 0; c < MAXOBJ; c++)
|
||||
_obj[c]._position = -1;
|
||||
|
||||
initNames();
|
||||
initScript();
|
||||
openSys();
|
||||
|
||||
LoadAll();
|
||||
|
||||
InitMessageSystem(); // schedule.c
|
||||
_inventorySize = 0;
|
||||
memset(_inventory, iNULL, MAXICON);
|
||||
|
||||
_inventory[_inventorySize++] = iBANCONOTE;
|
||||
_inventory[_inventorySize++] = iSAM;
|
||||
_inventory[_inventorySize++] = iCARD03;
|
||||
_inventory[_inventorySize++] = iPEN;
|
||||
_inventory[_inventorySize++] = iKEY05;
|
||||
|
||||
_curRoom = rINTRO;
|
||||
|
||||
ProcessTime();
|
||||
|
||||
doEvent(MC_SYSTEM, ME_START, MP_DEFAULT, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/* -----------------25/12/96 16.40-------------------
|
||||
NextMessage
|
||||
--------------------------------------------------*/
|
||||
void NextMessage() {
|
||||
if (!SemNoPaintScreen)
|
||||
ProcessTime();
|
||||
|
||||
ProcessMouse();
|
||||
Scheduler();
|
||||
|
||||
if ((TheMessage->cls == MC_SYSTEM) && (TheMessage->event == ME_QUIT))
|
||||
CloseSys(NULL);
|
||||
|
||||
AtFrameHandler(BACKGROUND_ANIM);
|
||||
|
||||
ProcessTheMessage();
|
||||
|
||||
if (Semscriptactive)
|
||||
EvalScript();
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
25
engines/trecision/nl/lib/addtype.h
Normal file
25
engines/trecision/nl/lib/addtype.h
Normal file
@ -0,0 +1,25 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#define FORBIDDEN_SYMBOL_ALLOW_ALL
|
||||
#include "common/scummsys.h"
|
||||
typedef signed short int LLBOOL; // for backwards compatibility with saves
|
464
engines/trecision/nl/ll/llanim.cpp
Normal file
464
engines/trecision/nl/ll/llanim.cpp
Normal file
@ -0,0 +1,464 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "trecision/nl/lib/addtype.h"
|
||||
#include "trecision/nl/sysdef.h"
|
||||
#include "trecision/nl/struct.h"
|
||||
#include "trecision/nl/ll/llinc.h"
|
||||
#include "trecision/nl/3d/3dinc.h"
|
||||
#include "trecision/nl/extern.h"
|
||||
#include "trecision/nl/define.h"
|
||||
|
||||
// locals
|
||||
#define SMACKNULL 0
|
||||
#define SMACKOPEN 1
|
||||
#define SMACKCLOSE 2
|
||||
#define FULLMOTIONANIM 620
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
void CallSmackOpen(const char *name);
|
||||
void CallSmackClose();
|
||||
void CallSmackNextFrame();
|
||||
void CallSmackVolumePan(int buf, int track, int vol);
|
||||
void RegenSmackAnim(int num);
|
||||
void RegenSmackIcon(int StartIcon, int num);
|
||||
|
||||
uint16 _smackPal[MAXSMACK][256];
|
||||
uint8 _curSmackAction;
|
||||
uint8 _curSmackBuffer;
|
||||
|
||||
uint16 _playingAnims[MAXSMACK];
|
||||
uint16 _curAnimFrame[MAXSMACK];
|
||||
|
||||
uint16 _animMaxX, _animMinX, _animMaxY, _animMinY;
|
||||
uint16 _newData[260];
|
||||
uint32 _newData2[260];
|
||||
|
||||
/*-----------------29/04/96 16.38-------------------
|
||||
BCopy
|
||||
--------------------------------------------------*/
|
||||
void BCopy(uint32 Sco, uint8 *Src, uint32 Len) {
|
||||
extern bool _linearMode;
|
||||
uint32 CopyNow;
|
||||
|
||||
LockVideo();
|
||||
if ((Video == NULL) || (Len == 0))
|
||||
return ;
|
||||
|
||||
if (_linearMode && ((VideoPitch == 0) || (VideoPitch == SCREENLEN * 2))) {
|
||||
byte2word(Video + Sco, Src, _newData, Len);
|
||||
return ;
|
||||
}
|
||||
|
||||
int32 x1 = Sco % SCREENLEN;
|
||||
int32 y1 = Sco / SCREENLEN;
|
||||
|
||||
uint32 EndSco = Sco + Len;
|
||||
|
||||
int32 y2 = EndSco / SCREENLEN;
|
||||
|
||||
uint32 SrcSco = 0;
|
||||
|
||||
if (Len > SCREENLEN - x1)
|
||||
CopyNow = SCREENLEN - x1;
|
||||
else
|
||||
CopyNow = Len;
|
||||
|
||||
byte2word(Video + y1 * (VideoPitch / 2) + x1, Src + SrcSco, _newData, CopyNow);
|
||||
SrcSco += CopyNow;
|
||||
Len -= CopyNow;
|
||||
|
||||
for (int32 i = (y1 + 1); i <= (y2 - 1); i++) {
|
||||
CopyNow = SCREENLEN;
|
||||
byte2word(Video + i * (VideoPitch / 2), Src + SrcSco, _newData, CopyNow);
|
||||
SrcSco += CopyNow;
|
||||
Len -= CopyNow;
|
||||
}
|
||||
|
||||
if (Len > 0) {
|
||||
CopyNow = Len;
|
||||
byte2word(Video + y2 * (VideoPitch / 2), Src + SrcSco, _newData, CopyNow);
|
||||
// Useless assignations, removed
|
||||
// SrcSco += CopyNow;
|
||||
// Len -= CopyNow;
|
||||
}
|
||||
}
|
||||
/*-----------------29/04/96 16.38-------------------
|
||||
DCopy
|
||||
--------------------------------------------------*/
|
||||
void DCopy(uint32 Sco, uint8 *Src, uint32 Len) {
|
||||
extern bool _linearMode;
|
||||
|
||||
LockVideo();
|
||||
if ((Video == NULL) || (Len == 0))
|
||||
return ;
|
||||
|
||||
if (_linearMode && ((VideoPitch == 0) || (VideoPitch == SCREENLEN * 2))) {
|
||||
byte2long(Video + Sco, Src, _newData2, Len / 2);
|
||||
return ;
|
||||
}
|
||||
|
||||
int32 x1 = Sco % SCREENLEN;
|
||||
int32 y1 = Sco / SCREENLEN;
|
||||
|
||||
uint32 EndSco = Sco + Len;
|
||||
|
||||
int32 y2 = EndSco / SCREENLEN;
|
||||
|
||||
uint32 SrcSco = 0;
|
||||
|
||||
uint32 CopyNow;
|
||||
if (Len > SCREENLEN - x1)
|
||||
CopyNow = SCREENLEN - x1;
|
||||
else
|
||||
CopyNow = Len;
|
||||
|
||||
byte2long(Video + y1 * (VideoPitch / 2) + x1, Src + SrcSco, _newData2, CopyNow / 2);
|
||||
SrcSco += CopyNow;
|
||||
Len -= CopyNow;
|
||||
|
||||
for (int32 i = (y1 + 1); i <= (y2 - 1); i++) {
|
||||
CopyNow = SCREENLEN;
|
||||
byte2long(Video + i * (VideoPitch / 2), Src + SrcSco, _newData2, CopyNow / 2);
|
||||
SrcSco += CopyNow;
|
||||
Len -= CopyNow;
|
||||
}
|
||||
|
||||
if (Len > 0) {
|
||||
CopyNow = Len;
|
||||
byte2long(Video + y2 * (VideoPitch / 2), Src + SrcSco, _newData2, CopyNow / 2);
|
||||
// Useless assignment, removed
|
||||
// SrcSco += CopyNow;
|
||||
// Len -= CopyNow;
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------17/11/96 14.46-------------------
|
||||
StartSmackAnim
|
||||
--------------------------------------------------*/
|
||||
void StartSmackAnim(uint16 num) {
|
||||
extern char UStr[];
|
||||
extern short SFxVol;
|
||||
int pos;
|
||||
|
||||
_curSmackAction = SMACKOPEN;
|
||||
|
||||
// sceglie quale buffer usare
|
||||
if (AnimTab[num].flag & SMKANIM_BKG)
|
||||
pos = 0;
|
||||
else if (AnimTab[num].flag & SMKANIM_ICON)
|
||||
pos = 2;
|
||||
else {
|
||||
pos = 1;
|
||||
|
||||
_animMaxX = 0;
|
||||
_animMinX = MAXX;
|
||||
_animMaxY = 0;
|
||||
_animMinY = MAXY;
|
||||
}
|
||||
|
||||
_curSmackBuffer = pos;
|
||||
|
||||
if (_playingAnims[pos] != 0) {
|
||||
_curSmackAction = SMACKNULL;
|
||||
StopSmackAnim(_playingAnims[pos]);
|
||||
_curSmackAction = SMACKOPEN;
|
||||
}
|
||||
|
||||
_playingAnims[pos] = num;
|
||||
_curAnimFrame[pos] = 0;
|
||||
|
||||
// sceglie come aprire
|
||||
if (AnimTab[num].flag & SMKANIM_BKG) {
|
||||
sprintf(UStr, "Bkg\\%s", AnimTab[num].name);
|
||||
CallSmackOpen((const char *)AnimFileOpen(AnimTab[num].name));
|
||||
CallSmackVolumePan(0, 3, (32768 * 2 * SFxVol) / 125);
|
||||
CallSmackVolumePan(0, 2, (32768 * 2 * SFxVol) / 125);
|
||||
CallSmackVolumePan(0, 1, (32768 * 2 * SFxVol) / 125);
|
||||
|
||||
// spegne quelle che non servono
|
||||
if ((num == aBKG11) && (AnimTab[num].flag & SMKANIM_OFF1))
|
||||
CallSmackVolumePan(0, 1, 0);
|
||||
else if ((num == aBKG14) && (AnimTab[num].flag & SMKANIM_OFF1))
|
||||
CallSmackVolumePan(0, 1, 0);
|
||||
else if ((num == aBKG1C) && (_obj[oFAX17]._flag & OBJFLAG_EXTRA)) {
|
||||
AnimTab[num].flag |= SMKANIM_OFF1;
|
||||
CallSmackVolumePan(0, 1, 0);
|
||||
} else if ((num == aBKG1D) && (AnimTab[num].flag & SMKANIM_OFF1))
|
||||
CallSmackVolumePan(0, 1, 0);
|
||||
else if ((num == aBKG22) && (AnimTab[num].flag & SMKANIM_OFF1))
|
||||
CallSmackVolumePan(0, 1, 0);
|
||||
else if ((num == aBKG48) && (AnimTab[num].flag & SMKANIM_OFF1))
|
||||
CallSmackVolumePan(0, 1, 0);
|
||||
else if ((num == aBKG4P) && (AnimTab[num].flag & SMKANIM_OFF1))
|
||||
CallSmackVolumePan(0, 1, 0);
|
||||
else if ((num == aBKG28) && (AnimTab[num].flag & SMKANIM_OFF4))
|
||||
CallSmackVolumePan(0, 1, 0);
|
||||
else if ((num == aBKG37) && (!(Room[_curRoom]._flag & OBJFLAG_EXTRA)))
|
||||
CallSmackVolumePan(0, 1, 0);
|
||||
else if ((num == aBKG2E) && (AnimTab[num].flag & SMKANIM_OFF2))
|
||||
CallSmackVolumePan(0, 2, 0);
|
||||
else if ((num == aBKG2G) && (_choice[556]._flag & OBJFLAG_DONE))
|
||||
CallSmackVolumePan(0, 2, 0);
|
||||
else if ((num == aBKG34) && // se sono nella 34 e
|
||||
((_choice[616]._flag & OBJFLAG_DONE) || // ho gia' fatto fmv o
|
||||
(_obj[oTUBOT34]._mode & OBJMODE_OBJSTATUS) || // c'e' il tubo intero
|
||||
(_obj[oTUBOFT34]._mode & OBJMODE_OBJSTATUS) || // c'e' il tubo fuori o
|
||||
(_obj[oVALVOLAC34]._mode & OBJMODE_OBJSTATUS))) // la valovola e' chiusa
|
||||
CallSmackVolumePan(0, 2, 0);
|
||||
} else if (AnimTab[num].flag & SMKANIM_ICON) {
|
||||
sprintf(UStr, "Icon\\%s", AnimTab[num].name);
|
||||
CallSmackOpen((const char *)AnimFileOpen(AnimTab[num].name));
|
||||
} else {
|
||||
extern uint32 NextRefresh;
|
||||
uint32 st = ReadTime();
|
||||
|
||||
sprintf(UStr, "Anim\\%s", AnimTab[num].name);
|
||||
CallSmackOpen((const char *)AnimFileOpen(AnimTab[num].name));
|
||||
CallSmackVolumePan(1, 1, (32768 * 2 * SFxVol) / 125);
|
||||
NextRefresh += (ReadTime() - st); // fixup opening time
|
||||
}
|
||||
|
||||
_curSmackAction = SMACKNULL;
|
||||
}
|
||||
|
||||
/*-----------------17/11/96 14.47-------------------
|
||||
StopSmackAnim
|
||||
--------------------------------------------------*/
|
||||
void StopSmackAnim(uint16 num) {
|
||||
int pos;
|
||||
|
||||
if (num == 0)
|
||||
return ;
|
||||
|
||||
_curSmackAction = SMACKCLOSE;
|
||||
|
||||
pos = 0;
|
||||
|
||||
while ((pos < MAXSMACK) && (_playingAnims[pos] != num))
|
||||
pos ++;
|
||||
|
||||
if (pos >= MAXSMACK) {
|
||||
if (AnimTab[num].flag & SMKANIM_BKG)
|
||||
pos = 0;
|
||||
else if (AnimTab[num].flag & SMKANIM_ICON)
|
||||
pos = 2;
|
||||
else
|
||||
pos = 1;
|
||||
}
|
||||
|
||||
_playingAnims[pos] = 0;
|
||||
_curAnimFrame[pos] = 0;
|
||||
|
||||
_curSmackBuffer = pos;
|
||||
CallSmackClose();
|
||||
|
||||
_curSmackAction = SMACKNULL;
|
||||
|
||||
LightIcon = -1;
|
||||
}
|
||||
|
||||
/* -----------------15/08/97 14.29-------------------
|
||||
StopAllSmackAnims
|
||||
--------------------------------------------------*/
|
||||
void StopAllSmackAnims() {
|
||||
int a;
|
||||
|
||||
for (a = 0; a < MAXSMACK; a++) {
|
||||
if (_playingAnims[a])
|
||||
StopSmackAnim(_playingAnims[a]);
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------17/11/96 14.46-------------------
|
||||
StartFullMotion
|
||||
--------------------------------------------------*/
|
||||
void StartFullMotion(const char *name) {
|
||||
int pos;
|
||||
extern int FullStart, FullEnd;
|
||||
extern short SpeechVol, SFxVol, SpeechON;
|
||||
|
||||
// spegne tutte le altre animazioni
|
||||
for (pos = 0; pos < MAXSMACK; pos++) {
|
||||
if (_playingAnims[pos] != 0) {
|
||||
_curSmackAction = SMACKNULL;
|
||||
StopSmackAnim(_playingAnims[pos]);
|
||||
}
|
||||
}
|
||||
_curSmackAction = SMACKOPEN;
|
||||
|
||||
pos = 1;
|
||||
_curSmackBuffer = pos;
|
||||
|
||||
_playingAnims[pos] = FULLMOTIONANIM;
|
||||
_curAnimFrame[pos] = 0;
|
||||
|
||||
SemShowHomo = 0;
|
||||
FullStart = 0;
|
||||
FullEnd = 0;
|
||||
TextStatus = TEXT_OFF;
|
||||
wordset(Video2, 0, TOP * MAXX);
|
||||
ShowScreen(0, 0, MAXX, TOP);
|
||||
wordset(Video2 + (TOP + AREA)*MAXX, 0, TOP * MAXX);
|
||||
wordset(Video2, 0, MAXX * MAXY);
|
||||
ShowScreen(0, AREA + TOP, MAXX, TOP);
|
||||
UnlockVideo();
|
||||
|
||||
InitQueue(&Game);
|
||||
InitQueue(&Anim);
|
||||
InitQueue(&Homo);
|
||||
actorStop();
|
||||
SemMouseEnabled = false;
|
||||
|
||||
CallSmackOpen((const char *)FmvFileOpen(name));
|
||||
CallSmackVolumePan(pos, 2, (32768 * 2 * SFxVol) / 125);
|
||||
CallSmackVolumePan(pos, 1, (32768 * 2 * SFxVol) / 125);
|
||||
if (SpeechON)
|
||||
CallSmackVolumePan(pos, 7, (32768 * 2 * SpeechVol) / 125);
|
||||
else
|
||||
CallSmackVolumePan(pos, 7, 0);
|
||||
|
||||
_curSmackAction = SMACKNULL;
|
||||
}
|
||||
|
||||
/*-----------------17/11/96 14.47-------------------
|
||||
StopFullMotion
|
||||
--------------------------------------------------*/
|
||||
void StopFullMotion() {
|
||||
extern int FullStart, FullEnd;
|
||||
int pos;
|
||||
|
||||
_curSmackAction = SMACKCLOSE;
|
||||
|
||||
pos = 1;
|
||||
_curSmackBuffer = pos;
|
||||
|
||||
if (_playingAnims[pos] == 0)
|
||||
return ;
|
||||
|
||||
_playingAnims[pos] = 0;
|
||||
_curAnimFrame[pos] = 0;
|
||||
|
||||
CallSmackClose();
|
||||
|
||||
_curSmackAction = SMACKNULL;
|
||||
|
||||
SemDialogActive = false;
|
||||
SemDialogMenuActive = false;
|
||||
SemMouseEnabled = true;
|
||||
SemSomeOneSpeak = false;
|
||||
|
||||
LightIcon = -1;
|
||||
FullStart = 0;
|
||||
FullEnd = 0;
|
||||
if (_curDialog == dFCRED) {
|
||||
CloseSys(NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (/*( _curDialog != dF1C1 ) && */ !((_curDialog == dNEGOZIANTE1A) && (_curChoice == 185))) {
|
||||
if ((_curDialog == dF582) || (_curDialog == dFLOG) || (_curDialog == dINTRO) || (_curDialog == dF362) || (_curDialog == dC381) || (_curDialog == dF381) ||
|
||||
(_curDialog == dF491) || ((_curDialog == dC581) && !(_choice[886]._flag & OBJFLAG_DONE) && (_choice[258]._flag & OBJFLAG_DONE)) ||
|
||||
((_curDialog == dC5A1) && (Room[r5A]._flag & OBJFLAG_EXTRA)))
|
||||
SemShowHomo = 0;
|
||||
else
|
||||
RedrawRoom();
|
||||
|
||||
if (_curDialog == dF582)
|
||||
SoundFadOut();
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------26/11/96 17.58-------------------
|
||||
RegenAnim
|
||||
--------------------------------------------------*/
|
||||
void RegenAnim(int box) {
|
||||
for (int a = 0; a < MAXSMACK; a++) {
|
||||
if ((_playingAnims[a] != 0) && (box == BACKGROUND)) {
|
||||
if ((a == 1) && (_playingAnims[a] == FULLMOTIONANIM))
|
||||
RegenFullMotion();
|
||||
else if (a != 1)
|
||||
RegenSmackAnim(_playingAnims[a]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------
|
||||
RedrawRoom
|
||||
--------------------------------------------------*/
|
||||
void RedrawRoom() {
|
||||
if ((_curDialog != dF321) && (_curDialog != dF431) && (_curDialog != dF4C1) && (_curDialog != dASCENSORE12) && (_curDialog != dASCENSORE13) && (_curDialog != dASCENSORE16))
|
||||
SemShowHomo = true;
|
||||
|
||||
switch (_curDialog) {
|
||||
case dASCENSORE12:
|
||||
if (_curChoice == 3)
|
||||
StartCharacterAction(a129PARLACOMPUTERESCENDE, r13, 20, 0);
|
||||
else if (_curChoice == 4)
|
||||
StartCharacterAction(a129PARLACOMPUTERESCENDE, r16, 20, 0);
|
||||
break;
|
||||
|
||||
case dASCENSORE13:
|
||||
if (_curChoice == 17)
|
||||
StartCharacterAction(a139CHIUDONOPORTESU, r12, 20, 0);
|
||||
else if (_curChoice == 18)
|
||||
StartCharacterAction(a1316CHIUDONOPORTEGIU, r16, 20, 0);
|
||||
break;
|
||||
|
||||
case dASCENSORE16:
|
||||
if (_curChoice == 32)
|
||||
StartCharacterAction(a1616SALECONASCENSORE, r12, 20, 0);
|
||||
else if (_curChoice == 33)
|
||||
StartCharacterAction(a1616SALECONASCENSORE, r13, 20, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
CurSortTableNum = 0;
|
||||
memset(OldObjStatus, 0, MAXOBJINROOM);
|
||||
memset(VideoObjStatus, 0, MAXOBJINROOM);
|
||||
|
||||
wordset(Video2, 0, CurRoomMaxX * MAXY);
|
||||
if (Room[_curRoom]._bkgAnim)
|
||||
MCopy(ImagePointer, SmackImagePointer, CurRoomMaxX * AREA);
|
||||
MCopy(Video2 + TOP * CurRoomMaxX, ImagePointer, CurRoomMaxX * AREA);
|
||||
|
||||
if (Room[_curRoom]._bkgAnim)
|
||||
StartSmackAnim(Room[_curRoom]._bkgAnim);
|
||||
|
||||
if ((_curRoom == r4P) && (_curDialog == dF4PI)) {
|
||||
memset(SmackBuffer[0], 0, SCREENLEN * AREA);
|
||||
CallSmackGoto(0, 21);
|
||||
}
|
||||
|
||||
RegenRoom();
|
||||
|
||||
TextStatus = TEXT_OFF;
|
||||
SemPaintHomo = 1;
|
||||
PaintScreen(1);
|
||||
ShowScreen(0, 0, 640, 480);
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
85
engines/trecision/nl/ll/llasm.cpp
Normal file
85
engines/trecision/nl/ll/llasm.cpp
Normal file
@ -0,0 +1,85 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../lib/addtype.h"
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
void wordcopy(void *dest, void *src, uint32 len) {
|
||||
uint16 *d = (uint16 *)dest, *s = (uint16 *)src;
|
||||
for (uint32 i = 0; i < len; i++)
|
||||
*d++ = *s++;
|
||||
}
|
||||
void longcopy(void *dest, void *src, uint32 len) {
|
||||
uint32 *d = (uint32 *)dest, *s = (uint32 *)src;
|
||||
for (uint32 i = 0; i < len; i++)
|
||||
*d++ = *s++;
|
||||
}
|
||||
void wordset(void *dest, uint16 value, uint32 len) {
|
||||
uint16 *d = (uint16 *)dest;
|
||||
for (uint32 i = 0; i < len; i++)
|
||||
*d++ = value;
|
||||
}
|
||||
void longset(void *dest, uint32 value, uint32 len) {
|
||||
uint32 *d = (uint32 *)dest;
|
||||
for (uint32 i = 0; i < len; i++)
|
||||
*d++ = value;
|
||||
}
|
||||
|
||||
void byte2word(void *dest, void *src, void *data, uint32 len) {
|
||||
uint16 *d = (uint16 *)dest, *p = (uint16 *)data;
|
||||
uint8 *s = (uint8 *)src;
|
||||
for (uint32 i = 0; i < len; i++)
|
||||
*d++ = p[*s++];
|
||||
}
|
||||
void byte2long(void *dest, void *src, void *data, uint32 len) {
|
||||
uint32 *d = (uint32 *)dest, *p = (uint32 *)data;
|
||||
uint8 *s = (uint8 *)src;
|
||||
for (uint32 i = 0; i < len; i++)
|
||||
*d++ = p[*s++];
|
||||
}
|
||||
void byte2wordm(void *dest, void *src, void *data, uint32 len) {
|
||||
uint16 *d = (uint16 *)dest, *p = (uint16 *)data;
|
||||
uint8 *s = (uint8 *)src;
|
||||
for (uint32 i = 0; i < len; i++) {
|
||||
uint8 v = *s++;
|
||||
if (v == 0)
|
||||
d++;
|
||||
else
|
||||
*d++ = p[v];
|
||||
}
|
||||
}
|
||||
void byte2wordn(void *dest, void *src, void *data, uint32 len) {
|
||||
uint16 *d = (uint16 *)dest, *p = (uint16 *)data, *t = (uint16 *)((uint8 *)(dest) - 537600);
|
||||
uint8 *s = (uint8 *)src;
|
||||
for (uint32 i = 0; i < len; i++) {
|
||||
uint8 v = *s++;
|
||||
if (v == 0)
|
||||
*d++ = *t++;
|
||||
else {
|
||||
*d++ = p[v];
|
||||
t++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
135
engines/trecision/nl/ll/lldec.cpp
Normal file
135
engines/trecision/nl/ll/lldec.cpp
Normal file
@ -0,0 +1,135 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <common/array.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "trecision/nl/lib/addtype.h"
|
||||
#include "trecision/nl/3d/3dinc.h"
|
||||
#include "trecision/nl/struct.h"
|
||||
#include "trecision/nl/ll/llinc.h"
|
||||
#include "trecision/nl/extern.h"
|
||||
|
||||
#define FAST_COOKIE 0xFA57F00D
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
void decompress(const unsigned char *src, unsigned src_len, unsigned char *dst, unsigned dst_len) {
|
||||
unsigned short *sw = (unsigned short *)(src + src_len);
|
||||
unsigned char *d = dst;
|
||||
const unsigned char *s = src;
|
||||
unsigned short ctrl = 0, ctrl_cnt = 1;
|
||||
|
||||
dst_len++;
|
||||
dst_len--;
|
||||
|
||||
while (s < (const unsigned char *)sw) {
|
||||
if (!--ctrl_cnt) {
|
||||
ctrl = *--sw;
|
||||
ctrl_cnt = 16;
|
||||
} else {
|
||||
ctrl <<= 1;
|
||||
}
|
||||
|
||||
if (ctrl & 0x8000) {
|
||||
unsigned foo = *--sw;
|
||||
const unsigned char *cs = d - (foo >> 4);
|
||||
|
||||
switch (foo & 0xF) {
|
||||
case 0:
|
||||
*d++ = *cs++;
|
||||
case 1:
|
||||
*d++ = *cs++;
|
||||
case 2:
|
||||
*d++ = *cs++;
|
||||
case 3:
|
||||
*d++ = *cs++;
|
||||
case 4:
|
||||
*d++ = *cs++;
|
||||
case 5:
|
||||
*d++ = *cs++;
|
||||
case 6:
|
||||
*d++ = *cs++;
|
||||
case 7:
|
||||
*d++ = *cs++;
|
||||
case 8:
|
||||
*d++ = *cs++;
|
||||
case 9:
|
||||
*d++ = *cs++;
|
||||
case 10:
|
||||
*d++ = *cs++;
|
||||
case 11:
|
||||
*d++ = *cs++;
|
||||
case 12:
|
||||
*d++ = *cs++;
|
||||
case 13:
|
||||
*d++ = *cs++;
|
||||
case 14:
|
||||
*d++ = *cs++;
|
||||
case 15:
|
||||
*d++ = *cs++;
|
||||
|
||||
*d++ = *cs++;
|
||||
*d++ = *cs++;
|
||||
}
|
||||
} else {
|
||||
*d++ = *s++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32 DecCR(const char *FileName, uint8 *DestArea, uint8 *DecArea) {
|
||||
ff = FastFileOpen(FileName);
|
||||
if (ff == NULL)
|
||||
error("File not found %s", FileName);
|
||||
|
||||
char *ibuf = (char *)DecArea;
|
||||
char *obuf = (char *)DestArea;
|
||||
|
||||
int isize = FastFileLen(ff);
|
||||
|
||||
if ((isize != FastFileRead(ff, ibuf, isize)))
|
||||
CloseSys(_sysSent[5]);
|
||||
FastFileClose(ff);
|
||||
|
||||
if (*(unsigned *)ibuf != FAST_COOKIE)
|
||||
CloseSys(_sysSent[7]);
|
||||
|
||||
ibuf += sizeof(unsigned);
|
||||
isize -= sizeof(unsigned);
|
||||
|
||||
int osize = *(unsigned *)ibuf;
|
||||
ibuf += sizeof(unsigned);
|
||||
isize -= sizeof(unsigned);
|
||||
|
||||
if (isize < osize)
|
||||
decompress((unsigned char *)ibuf, isize, (unsigned char *)obuf, osize);
|
||||
else {
|
||||
isize -= sizeof(unsigned);
|
||||
memcpy(obuf, ibuf, isize);
|
||||
}
|
||||
|
||||
return (osize);
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
147
engines/trecision/nl/ll/llinc.h
Normal file
147
engines/trecision/nl/ll/llinc.h
Normal file
@ -0,0 +1,147 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#define DRAWMASK 1
|
||||
#define COPYTORAM 2
|
||||
#define COPYTOVIDEO 4
|
||||
|
||||
#define TEXT_OFF 0
|
||||
#define TEXT_ON 1
|
||||
#define TEXT_DRAW 2
|
||||
#define TEXT_DEL 4
|
||||
|
||||
#define MAXTEXTAREA 200000L
|
||||
#define SMKANBUFFER 6L
|
||||
#define SMKBKGBUFFER 4L
|
||||
#define SMKICONBUFFER 2L
|
||||
|
||||
#define MAXSYSSENT 30
|
||||
|
||||
#define MAXSMACK 3
|
||||
#define MAXFILEREF 5000
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
// DRAW STRUCT
|
||||
struct SDText {
|
||||
uint16 x;
|
||||
uint16 y;
|
||||
uint16 dx;
|
||||
uint16 dy;
|
||||
uint16 l[4];
|
||||
uint16 tcol, scol;
|
||||
const char *sign;
|
||||
};
|
||||
|
||||
|
||||
struct SDObj {
|
||||
uint16 x;
|
||||
uint16 y;
|
||||
uint16 dx;
|
||||
uint16 dy;
|
||||
uint16 l[4];
|
||||
uint16 *buf;
|
||||
uint8 *mask;
|
||||
uint8 flag; /* 0 - with mask
|
||||
1 - copy to Video
|
||||
2 - copy to Video2 */
|
||||
|
||||
};
|
||||
|
||||
// fastfile
|
||||
typedef struct {
|
||||
char name[12];
|
||||
int offset;
|
||||
} FILEENTRY, *LPFILEENTRY;
|
||||
|
||||
typedef struct SFileHandle {
|
||||
char inuse;
|
||||
int pos;
|
||||
int size;
|
||||
LPFILEENTRY pfe;
|
||||
} FILEHANDLE, *LPFILEHANDLE;
|
||||
|
||||
|
||||
// FUNCTIONS
|
||||
|
||||
// VIDEO
|
||||
extern uint16 *Video, VideoPitch;
|
||||
extern uint16 *Video2;
|
||||
// GAME POINTER
|
||||
extern uint16 *ImagePointer;
|
||||
extern uint16 *SmackImagePointer;
|
||||
extern uint16 *ObjPointers[];
|
||||
extern uint8 *MaskPointers[];
|
||||
extern uint8 *SoundPointer[];
|
||||
extern uint8 *_actionPointer[];
|
||||
extern uint16 _actionPosition[];
|
||||
extern uint8 *SmackBuffer[];
|
||||
extern uint8 *SmackTempBuffer[];
|
||||
// DATA POINTER
|
||||
extern uint16 *Icone;
|
||||
extern uint8 *Font;
|
||||
extern uint8 *IntroFont;
|
||||
extern uint16 *Arrows;
|
||||
extern uint8 *TextArea;
|
||||
// 3D AREA
|
||||
extern int16 *ZBuffer;
|
||||
extern uint8 *_characterArea;
|
||||
extern uint8 *TextureArea;
|
||||
extern uint8 *BaseHeadTexture;
|
||||
extern uint8 AddObjectMaterial;
|
||||
// MEMORY
|
||||
extern uint32 GameBytePointer;
|
||||
extern uint32 GameWordPointer;
|
||||
extern uint32 TotalMemory;
|
||||
// SYS SENT
|
||||
extern const char *_sysSent[];
|
||||
// VESA
|
||||
extern uint8 CVP;
|
||||
extern uint16 VesaGranularity;
|
||||
extern int32 CurRoomMaxX;
|
||||
// DTEXT
|
||||
extern int8 DTextLines[MAXDTEXTLINES][MAXDTEXTCHARS];
|
||||
// SCROLL
|
||||
extern int32 VirtualPageLen;
|
||||
extern int32 CurScrollPageDx;
|
||||
extern int32 VideoScrollPageDx;
|
||||
// ANIMATION
|
||||
extern uint8 *SoundBuffer;
|
||||
extern uint32 CurBufferSize;
|
||||
extern uint8 *MemoryArea;
|
||||
extern uint8 *SoundStartBuffer;
|
||||
// SOUND
|
||||
extern uint8 SoundSystemActive;
|
||||
extern uint8 SpeechTrackEnabled;
|
||||
// MOUSE
|
||||
extern struct SDText TheString;
|
||||
extern struct SDText OldString;
|
||||
extern int8 MouseONOFF;
|
||||
extern uint8 TextStatus;
|
||||
extern LPFILEHANDLE ff;
|
||||
// FILEREF
|
||||
extern FILEENTRY FileRef[];
|
||||
extern int NumFileRef;
|
||||
|
||||
} // End of namespace Trecision
|
||||
|
||||
#include "trecision/nl/ll/llproto.h"
|
272
engines/trecision/nl/ll/llkbd.cpp
Normal file
272
engines/trecision/nl/ll/llkbd.cpp
Normal file
@ -0,0 +1,272 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <conio.h>
|
||||
#include <stdio.h>
|
||||
#include "trecision/nl/lib/addtype.h"
|
||||
#include "trecision/nl/3d/3dinc.h"
|
||||
#include "trecision/nl/SysDef.h"
|
||||
#include "trecision/nl/Struct.h"
|
||||
#include "trecision/nl/extern.h"
|
||||
#include "trecision/nl/ll/llinc.h"
|
||||
#include "trecision/nl/define.h"
|
||||
|
||||
#include <common/file.h>
|
||||
|
||||
#define KEY_BUFFER 0x60
|
||||
#define KEY_CONTROL 0x61
|
||||
#define INT_CONTROL 0x20
|
||||
#define KEYBOARD_INT 0x09
|
||||
|
||||
// make and break codes for the arrow keys
|
||||
|
||||
#define MAKE_RIGHT 77
|
||||
#define MAKE_LEFT 75
|
||||
#define MAKE_UP 72
|
||||
#define MAKE_DOWN 80
|
||||
#define MAKE_A 30
|
||||
#define MAKE_S 31
|
||||
#define MAKE_D 32
|
||||
#define MAKE_W 17
|
||||
#define MAKE_PLUS 78
|
||||
#define MAKE_MINUS 74
|
||||
#define MAKE_B 48
|
||||
#define MAKE_N 49
|
||||
#define MAKE_ENTER 28
|
||||
#define MAKE_P 25
|
||||
#define MAKE_L 38
|
||||
|
||||
#define BREAK_RIGHT 205
|
||||
#define BREAK_LEFT 203
|
||||
#define BREAK_UP 200
|
||||
#define BREAK_DOWN 208
|
||||
#define BREAK_A 158
|
||||
#define BREAK_S 159
|
||||
#define BREAK_D 160
|
||||
#define BREAK_W 145
|
||||
#define BREAK_PLUS 206
|
||||
#define BREAK_MINUS 202
|
||||
#define BREAK_B 176
|
||||
#define BREAK_ENTER 156
|
||||
|
||||
namespace Common {
|
||||
class File;
|
||||
}
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
char kbdtable[256]; // table of key presses low 128 is current
|
||||
// high 128 has been
|
||||
volatile char ct1; // keyboad interrupt vars
|
||||
volatile int ct2;
|
||||
|
||||
volatile char kbdbuffer[128]; // keep in memory last 128 key
|
||||
volatile char kbdbufferptr = 0;
|
||||
|
||||
char *TextPtr;
|
||||
|
||||
/* -----------------19/01/98 11.11-------------------
|
||||
* GetNextSent
|
||||
* --------------------------------------------------*/
|
||||
char *GetNextSent() {
|
||||
while (*TextPtr) {
|
||||
*TextPtr = ~(*TextPtr);
|
||||
TextPtr++;
|
||||
}
|
||||
|
||||
TextPtr++;
|
||||
return ((char *)(TextPtr));
|
||||
}
|
||||
|
||||
/* -----------------19/01/98 11.11-------------------
|
||||
* LoadAll
|
||||
* --------------------------------------------------*/
|
||||
void LoadAll() {
|
||||
Common::File dataNl;
|
||||
if (!dataNl.open("DATA.NL"))
|
||||
error("LoadAll : Couldn't open DATA.NL");
|
||||
|
||||
for (int i = 0; i < MAXROOMS; ++i) {
|
||||
for (int j = 0; j < 4; ++j)
|
||||
Room[i]._baseName[j] = dataNl.readSByte();
|
||||
Room[i]._flag = dataNl.readByte();
|
||||
dataNl.readByte(); // Padding
|
||||
Room[i]._bkgAnim = dataNl.readUint16LE();
|
||||
for (int j = 0; j < MAXOBJINROOM; ++j)
|
||||
Room[i]._object[j] = dataNl.readUint16LE();
|
||||
for (int j = 0; j < MAXSOUNDSINROOM; ++j)
|
||||
Room[i]._sounds[j] = dataNl.readUint16LE();
|
||||
for (int j = 0; j < MAXACTIONINROOM; ++j)
|
||||
Room[i]._actions[j] = dataNl.readUint16LE();
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAXOBJ; ++i) {
|
||||
_obj[i]._dx = dataNl.readUint16LE();
|
||||
_obj[i]._dy = dataNl.readUint16LE();
|
||||
_obj[i]._px = dataNl.readUint16LE();
|
||||
_obj[i]._py = dataNl.readUint16LE();
|
||||
|
||||
for (int j = 0; j < 4; ++j)
|
||||
_obj[i]._lim[j] = dataNl.readUint16LE();
|
||||
|
||||
_obj[i]._position = dataNl.readSByte();
|
||||
dataNl.readByte(); // Padding
|
||||
_obj[i]._name = dataNl.readUint16LE();
|
||||
_obj[i]._examine = dataNl.readUint16LE();
|
||||
_obj[i]._action = dataNl.readUint16LE();
|
||||
_obj[i]._goRoom = dataNl.readByte();
|
||||
_obj[i]._nbox = dataNl.readByte();
|
||||
_obj[i]._ninv = dataNl.readByte();
|
||||
_obj[i]._mode = dataNl.readByte();
|
||||
_obj[i]._flag = dataNl.readByte();
|
||||
dataNl.readByte(); // Padding
|
||||
_obj[i]._anim = dataNl.readUint16LE();
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAXINVENTORY; ++i) {
|
||||
InvObj[i]._name = dataNl.readUint16LE();
|
||||
InvObj[i]._examine = dataNl.readUint16LE();
|
||||
InvObj[i]._action = dataNl.readUint16LE();
|
||||
InvObj[i]._flag = dataNl.readByte();
|
||||
dataNl.readByte(); // Padding
|
||||
InvObj[i]._anim = dataNl.readUint16LE();
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAXSAMPLE; ++i) {
|
||||
for (int j = 0; j < 14; ++j)
|
||||
GSample[i].name[j] = dataNl.readByte();
|
||||
GSample[i].volume = dataNl.readByte();
|
||||
GSample[i].flag = dataNl.readByte();
|
||||
GSample[i].panning = dataNl.readSByte();
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAXSCRIPTFRAME; ++i) {
|
||||
ScriptFrame[i].cls = dataNl.readByte();
|
||||
ScriptFrame[i].event = dataNl.readByte();
|
||||
ScriptFrame[i].bparam = dataNl.readByte();
|
||||
dataNl.readByte(); // Padding
|
||||
ScriptFrame[i].wparam1 = dataNl.readUint16LE();
|
||||
ScriptFrame[i].wparam2 = dataNl.readUint16LE();
|
||||
ScriptFrame[i].lparam = dataNl.readUint16LE();
|
||||
ScriptFrame[i].nowait = !(dataNl.readByte() == 0);
|
||||
dataNl.readByte();
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAXSCRIPT; ++i) {
|
||||
Script[i].firstframe = dataNl.readUint16LE();
|
||||
Script[i].flag = !(dataNl.readByte() == 0);
|
||||
dataNl.readByte();
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAXANIM; ++i) {
|
||||
for (int j = 0; j < 14; ++j)
|
||||
AnimTab[i].name[j] = dataNl.readByte();
|
||||
|
||||
AnimTab[i].flag = dataNl.readUint16LE();
|
||||
|
||||
for (int j = 0; j < MAXCHILD; ++j) {
|
||||
AnimTab[i].lim[j][0] = dataNl.readUint16LE();
|
||||
AnimTab[i].lim[j][1] = dataNl.readUint16LE();
|
||||
AnimTab[i].lim[j][2] = dataNl.readUint16LE();
|
||||
AnimTab[i].lim[j][3] = dataNl.readUint16LE();
|
||||
}
|
||||
|
||||
AnimTab[i].nbox = dataNl.readByte();
|
||||
dataNl.readByte(); // Padding
|
||||
|
||||
for (int j = 0; j < MAXATFRAME; ++j) {
|
||||
AnimTab[i].atframe[j].type = dataNl.readByte();
|
||||
AnimTab[i].atframe[j].child = dataNl.readByte();
|
||||
AnimTab[i].atframe[j].nframe = dataNl.readUint16LE();
|
||||
AnimTab[i].atframe[j].index = dataNl.readUint16LE();
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAXDIALOG; ++i) {
|
||||
_dialog[i]._flag = dataNl.readUint16LE();
|
||||
_dialog[i]._interlocutor = dataNl.readUint16LE();
|
||||
|
||||
for (int j = 0; j < 14; ++j)
|
||||
_dialog[i]._startAnim[j] = dataNl.readByte();
|
||||
|
||||
_dialog[i]._startLen = dataNl.readUint16LE();
|
||||
_dialog[i]._firstChoice = dataNl.readUint16LE();
|
||||
_dialog[i]._choiceNumb = dataNl.readUint16LE();
|
||||
|
||||
for (int j = 0; j < MAXNEWSMKPAL; ++j)
|
||||
_dialog[i]._newPal[j] = dataNl.readUint16LE();
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAXCHOICE; ++i) {
|
||||
_choice[i]._flag = dataNl.readUint16LE();
|
||||
_choice[i]._sentenceIndex = dataNl.readUint16LE();
|
||||
_choice[i]._firstSubTitle = dataNl.readUint16LE();
|
||||
_choice[i]._subTitleNumb = dataNl.readUint16LE();
|
||||
|
||||
for (int j = 0; j < MAXDISPSCELTE; ++j)
|
||||
_choice[i]._on[j] = dataNl.readUint16LE();
|
||||
|
||||
for (int j = 0; j < MAXDISPSCELTE; ++j)
|
||||
_choice[i]._off[j] = dataNl.readUint16LE();
|
||||
|
||||
_choice[i]._startFrame = dataNl.readUint16LE();
|
||||
_choice[i]._nextDialog = dataNl.readUint16LE();
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAXSUBTITLES; ++i) {
|
||||
_subTitles[i]._sentence = dataNl.readUint16LE();
|
||||
_subTitles[i]._x = dataNl.readUint16LE();
|
||||
_subTitles[i]._y = dataNl.readUint16LE();
|
||||
_subTitles[i]._color = dataNl.readUint16LE();
|
||||
_subTitles[i]._startFrame = dataNl.readUint16LE();
|
||||
_subTitles[i]._length = dataNl.readUint16LE();
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAXACTION; ++i)
|
||||
_actionLen[i] = dataNl.readByte();
|
||||
|
||||
NumFileRef = dataNl.readSint32LE();
|
||||
|
||||
for (int i = 0; i < NumFileRef; ++i) {
|
||||
for (int j = 0; j < 12; ++j)
|
||||
FileRef[i].name[j] = dataNl.readByte();
|
||||
|
||||
FileRef[i].offset = dataNl.readSint32LE();
|
||||
}
|
||||
|
||||
dataNl.read(TextArea, MAXTEXTAREA);
|
||||
|
||||
TextPtr = (char *)TextArea;
|
||||
|
||||
for (int a = 0; a < MAXOBJNAME; a++)
|
||||
ObjName[a] = GetNextSent();
|
||||
|
||||
for (int a = 0; a < MAXSENTENCE; a++)
|
||||
Sentence[a] = GetNextSent();
|
||||
|
||||
for (int a = 0; a < MAXSYSSENT; a++)
|
||||
_sysSent[a] = GetNextSent();
|
||||
|
||||
dataNl.close();
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
1282
engines/trecision/nl/ll/llmouse.cpp
Normal file
1282
engines/trecision/nl/ll/llmouse.cpp
Normal file
File diff suppressed because it is too large
Load Diff
162
engines/trecision/nl/ll/llproto.h
Normal file
162
engines/trecision/nl/ll/llproto.h
Normal file
@ -0,0 +1,162 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
int ACompare(const void *p1, const void *p2);
|
||||
char AnimFileInit(const char *fname);
|
||||
void AnimFileFinish();
|
||||
int AnimFileOpen(const char *name);
|
||||
int FmvFileOpen(const char *name);
|
||||
char SpeechFileInit(const char *fname);
|
||||
void SpeechFileFinish();
|
||||
int SpeechFileLen(const char *name);
|
||||
int SpeechFileRead(const char *name, uint8 *buf);
|
||||
void BCopy(uint32 Sco, uint8 *Src, uint32 Len);
|
||||
void DCopy(uint32 Sco, uint8 *Src, uint32 Len);
|
||||
void StartSmackAnim(uint16 num);
|
||||
void StopSmackAnim(uint16 num);
|
||||
void StopAllSmackAnims();
|
||||
void CallSmackVolumePan(int buf, int track, int vol);
|
||||
void CallSmackGoto(int buf, int num);
|
||||
void CallSmackSoundOnOff(int pos, int on);
|
||||
void RegenAnim(int box);
|
||||
void RegenSmackAnim(int num);
|
||||
void RegenSmackIcon(int StartIcon, int num);
|
||||
void RedrawRoom();
|
||||
void *smkmalloc(unsigned int size);
|
||||
void smkfree(void *ptr);
|
||||
void decompress(const uint8 *src, unsigned int src_len, uint8 *dst, unsigned int dst_len);
|
||||
uint32 DecXPK(const char *ArcName, const char *FileName, uint8 *DestArea, uint8 *DecArea);
|
||||
void setbiosisr();
|
||||
void setrawisr();
|
||||
void installlowisr();
|
||||
char waitKey();
|
||||
char ReadKey();
|
||||
void FreeKey();
|
||||
char *GetNextSent();
|
||||
void SaveAll();
|
||||
void LoadAll();
|
||||
uint16 vr(int16 x, int16 y);
|
||||
void VPix(int16 x, int16 y, uint16 col);
|
||||
void VMouseOFF();
|
||||
void VMouseON();
|
||||
void VMouseRestore();
|
||||
void VMouseCopy();
|
||||
void Mouse(uint8 opt);
|
||||
uint16 TextLength(const char *sign, uint16 num);
|
||||
uint16 CheckDText(struct SDText t);
|
||||
void DText(struct SDText t);
|
||||
void IntroText(int16 x, int16 y, const char *sign, uint8 *buf);
|
||||
void IconSnapShot();
|
||||
int16 DataSave();
|
||||
int16 DataLoad();
|
||||
int16 QuitGame();
|
||||
void DemoOver();
|
||||
void CheckFileInCD(const char *name);
|
||||
void openSys();
|
||||
void OpenVideo();
|
||||
uint32 ReadActor(const char *filename, uint8 *Area);
|
||||
void CloseSys(const char *str);
|
||||
void ReadLoc();
|
||||
void TendIn();
|
||||
void ReadObj();
|
||||
void ReadExtraObj2C();
|
||||
void ReadExtraObj41D();
|
||||
void ReadAnims();
|
||||
void ReadSounds();
|
||||
void RegenRoom();
|
||||
void PaintRegenRoom();
|
||||
void DrawObj(struct SDObj d);
|
||||
void VisualFrame(uint16 CurAnim);
|
||||
void KillFrame(uint16 CurAnim);
|
||||
void RegenInventory(uint8 StartIcon, uint8 StartLine);
|
||||
void RGBColor(uint16 a, uint8 *r, uint8 *g, uint8 *b);
|
||||
uint16 RGB2Color(uint8 r, uint8 g, uint8 b);
|
||||
uint16 ULaw2Linear(uint8 ulawbyte);
|
||||
void GrabVideo();
|
||||
void SaveAction();
|
||||
void InitScrollPage(int flag);
|
||||
void VisualScrollPage(int dx);
|
||||
void ScrollPage(int dx);
|
||||
void AlternativeScrolling(int dx);
|
||||
void SetHeadTexture(uint8 num);
|
||||
void SetTexture(int flag);
|
||||
void StartSoundSystem();
|
||||
void StopSoundSystem();
|
||||
void LoadSound(int16 num, uint8 *Buffer);
|
||||
int16 LoadAudioWav(int num, uint8 *Buffer, int len);
|
||||
void NLPlaySound(int num);
|
||||
void NLStopSound(int num);
|
||||
void SoundFadOut();
|
||||
void SoundFadIn(int num);
|
||||
void WaitSoundFadEnd();
|
||||
void SoundPasso(int midx, int midz, int act, int frame, uint16 *list);
|
||||
void SetBackgroundVolume(int val);
|
||||
void serve_sample();
|
||||
void ContinueTalk();
|
||||
int32 Talk(const char *name);
|
||||
void StopTalk();
|
||||
void DetectVesaMode(unsigned int ModeNumber);
|
||||
void SetVesaMode(unsigned int ModeNumber);
|
||||
void SetVesaLineLength(unsigned int Length);
|
||||
void SetVesaStartVisualPage(unsigned int StartX, unsigned int StartY);
|
||||
void ResetZB(int x1, int y1, int x2, int y2);
|
||||
void SetVesaPage(unsigned int PageNumber);
|
||||
void VCopy(uint32 Sco, uint16 *Src, uint32 Len);
|
||||
void MCopy(uint16 *Dest, uint16 *Src, uint32 Len);
|
||||
void ShowScreen(int, int, int, int);
|
||||
void UpdatePixelFormat(uint16 *p, uint32 len);
|
||||
uint16 UnUpdatePixelFormat(uint16 t);
|
||||
void ClearScreen();
|
||||
uint32 ReadTime();
|
||||
void NlDelay(uint32 val);
|
||||
void NlDissolve(int val);
|
||||
uint32 TrecRnd(uint32 t);
|
||||
int16 CheckMask(uint16 MX, uint16 my);
|
||||
uint8 CheckMaskBox(uint16 mx, uint16 my);
|
||||
void WaitCop(uint8 num);
|
||||
void LockVideo();
|
||||
void UnlockVideo();
|
||||
void StartFullMotion(const char *name);
|
||||
void StopFullMotion();
|
||||
void RegenFullMotion();
|
||||
char FastFileInit(const char *fname);
|
||||
void FastFileFinish();
|
||||
struct SFileHandle *FastFileOpen(const char *name);
|
||||
char FastFileClose(struct SFileHandle *pfh);
|
||||
int FastFileRead(struct SFileHandle *pfh, void *ptr, int size);
|
||||
char FastFileSeek(struct SFileHandle *pfh, int off, int how);
|
||||
int32 FastFileTell(struct SFileHandle *pfh);
|
||||
int32 FastFileLen(struct SFileHandle *pfh);
|
||||
uint16 PalTo16bit(uint8 r, uint8 g, uint8 b);
|
||||
void wordcopy(void *dest, void *src, uint32 len);
|
||||
void longcopy(void *dest, void *src, uint32 len);
|
||||
void wordset(void *dest, uint16 value, uint32 len);
|
||||
void longset(void *dest, uint32 value, uint32 len);
|
||||
void byte2word(void *dest, void *src, void *data, uint32 len);
|
||||
void byte2long(void *dest, void *src, void *data, uint32 len);
|
||||
void byte2wordm(void *dest, void *src, void *data, uint32 len);
|
||||
void byte2wordn(void *dest, void *src, void *data, uint32 len);
|
||||
void byte2longm(void *dest, void *src, void *data, uint32 len);
|
||||
|
||||
} // End of namespace Trecision
|
993
engines/trecision/nl/ll/llscreen.cpp
Normal file
993
engines/trecision/nl/ll/llscreen.cpp
Normal file
@ -0,0 +1,993 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
//#include <dos.h>
|
||||
#include <conio.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "trecision/nl/lib/addtype.h"
|
||||
#include "trecision/nl/3d/3dinc.h"
|
||||
#include "trecision/nl/sysdef.h"
|
||||
#include "trecision/nl/struct.h"
|
||||
#include "trecision/nl/ll/llinc.h"
|
||||
#include "trecision/nl/extern.h"
|
||||
#include "trecision/nl/define.h"
|
||||
|
||||
#include <common/file.h>
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
// da cancellare
|
||||
int VertexNum, FaceNum, MatNum, LightNum;
|
||||
|
||||
#define MAXLIGHT 40
|
||||
#define MAXMAT 20
|
||||
|
||||
#define SOUND_OFF 0
|
||||
#define SOUND_ON 1
|
||||
|
||||
int MaxMemory = 0;
|
||||
// VIDEO
|
||||
uint16 *Video, VideoPitch;
|
||||
uint16 *Video2;
|
||||
// GAME POINTER
|
||||
uint16 *ImagePointer;
|
||||
uint16 *SmackImagePointer;
|
||||
uint16 *ObjPointers[MAXOBJINROOM];
|
||||
uint8 *MaskPointers[MAXOBJINROOM];
|
||||
uint8 *SoundPointer[MAXSOUNDSINROOM];
|
||||
uint8 *_actionPointer[MAXACTIONFRAMESINROOM]; // puntatore progressivo ai frame
|
||||
uint16 _actionPosition[MAXACTIONINROOM]; // Starting position of each action in the room
|
||||
uint8 *SmackBuffer[MAXSMACK];
|
||||
uint8 *SmackTempBuffer[MAXSMACK];
|
||||
// DATA POINTER
|
||||
uint16 *Icone;
|
||||
uint8 *Font;
|
||||
uint8 *IntroFont;
|
||||
uint16 *Arrows;
|
||||
uint8 *TextArea;
|
||||
uint8 *SpeechBuf[2];
|
||||
uint8 *MuLawBuf[2];
|
||||
uint16 *ExtraObj2C;
|
||||
uint16 *ExtraObj41D;
|
||||
// 3D AREA
|
||||
int16 *ZBuffer;
|
||||
uint8 *_characterArea;
|
||||
uint8 *TextureArea;
|
||||
uint8 *BaseHeadTexture;
|
||||
uint8 AddObjectMaterial;
|
||||
// MEMORY
|
||||
uint32 GameBytePointer;
|
||||
uint32 GameWordPointer;
|
||||
uint32 TotalMemory;
|
||||
// VESA
|
||||
uint8 CVP;
|
||||
uint16 VesaGranularity;
|
||||
int32 CurRoomMaxX = 640L;
|
||||
// DTEXT
|
||||
int8 DTextLines[MAXDTEXTLINES][MAXDTEXTCHARS];
|
||||
// SCROLL
|
||||
int32 VirtualPageLen = 640L;
|
||||
int32 CurScrollPageDx = 0L;
|
||||
int32 VideoScrollPageDx = 0L;
|
||||
// 3D
|
||||
struct SLight VLight[MAXLIGHT];
|
||||
struct SCamera FCamera;
|
||||
struct STexture FTexture[MAXMAT];
|
||||
// ANIMATION
|
||||
uint8 *MemoryArea;
|
||||
uint32 CurBufferSize;
|
||||
// SOUND
|
||||
uint8 SoundSystemActive;
|
||||
uint8 SpeechTrackEnabled = 0;
|
||||
uint8 *SoundStartBuffer;
|
||||
// Temporary variables
|
||||
FILE *fhi;
|
||||
LPFILEHANDLE ff;
|
||||
char UStr[140];
|
||||
int32 hh;
|
||||
// MOUSE
|
||||
struct SDText TheString;
|
||||
struct SDText OldString;
|
||||
int8 MouseONOFF = 1;
|
||||
uint8 TextStatus;
|
||||
// AOT.CFG
|
||||
short SpeechON = 1;
|
||||
short TextON = 1;
|
||||
short SpeechVol = 75;
|
||||
short MusicVol = 75;
|
||||
short SFxVol = 75;
|
||||
char CDLetter = 'F';
|
||||
char CurCDSet = 1;
|
||||
char GamePath[250];
|
||||
// ALTERNATIVE SCROLLING
|
||||
int ScrollBottle;
|
||||
short LeftArrow;
|
||||
short RightArrow;
|
||||
// FILEREF
|
||||
FILEENTRY FileRef[MAXFILEREF];
|
||||
int NumFileRef;
|
||||
|
||||
|
||||
const char *_sysSent[MAXSYSSENT];
|
||||
|
||||
// info for Toc BmData
|
||||
struct SBmInfo {
|
||||
uint16 px, py, dx, dy;
|
||||
} BmInfo;
|
||||
|
||||
#define NL_REQUIREDMEMORY 6100000L
|
||||
/*-----------------17/02/95 10.19-------------------
|
||||
openSys
|
||||
--------------------------------------------------*/
|
||||
void openSys() {
|
||||
Common::File testCD;
|
||||
for (CurCDSet = 1; CurCDSet <= 3; CurCDSet++) {
|
||||
Common::String filename = Common::String::format("NlAnim.cd%c", CurCDSet + '0');
|
||||
if (testCD.open(filename)) {
|
||||
testCD.close();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SoundSystemActive = SOUND_OFF;
|
||||
|
||||
StartSoundSystem();
|
||||
|
||||
CurBufferSize = NL_REQUIREDMEMORY;
|
||||
MemoryArea = (uint8 *)malloc(CurBufferSize);
|
||||
|
||||
memset(MemoryArea, 0, CurBufferSize);
|
||||
Video2 = (uint16 *)MemoryArea;
|
||||
|
||||
TotalMemory = CurBufferSize;
|
||||
|
||||
OpenVideo();
|
||||
}
|
||||
/*-----------------13/09/95 11.59-------------------
|
||||
OpenVideo
|
||||
--------------------------------------------------*/
|
||||
void OpenVideo() {
|
||||
|
||||
GameBytePointer = 0;
|
||||
GameWordPointer = 0;
|
||||
|
||||
sprintf(UStr, "%sData\\NlData.cd0", GamePath);
|
||||
// sprintf( UStr, "Data\\NlData.cd0" );
|
||||
FastFileInit(UStr);
|
||||
sprintf(UStr, "%sData\\NlSpeech.cd0", GamePath);
|
||||
// sprintf( UStr, "Data\\NlSpeech.cd0" );
|
||||
SpeechFileInit(UStr);
|
||||
sprintf(UStr, "%sData\\NlAnim.cd%c", GamePath, CurCDSet + '0');
|
||||
// sprintf( UStr, "Data\\NlAnim.cd%c", CurCDSet+'0' );
|
||||
AnimFileInit(UStr);
|
||||
|
||||
Video2 = (uint16 *)MemoryArea + 2000000L;
|
||||
|
||||
Font = (uint8 *)MemoryArea + GameBytePointer;
|
||||
ff = FastFileOpen("NlFont.fnt");
|
||||
GameBytePointer += FastFileRead(ff, (void *)Font, FastFileLen(ff));
|
||||
FastFileClose(ff);
|
||||
|
||||
IntroFont = (uint8 *)MemoryArea + GameBytePointer;
|
||||
ff = FastFileOpen("NlIntro.fnt");
|
||||
GameBytePointer += FastFileRead(ff, (void *)IntroFont, FastFileLen(ff));
|
||||
FastFileClose(ff);
|
||||
|
||||
Arrows = (uint16 *)(MemoryArea + GameBytePointer);
|
||||
ff = FastFileOpen("frecc.bm");
|
||||
GameBytePointer += FastFileRead(ff, (void *)Arrows, FastFileLen(ff));
|
||||
FastFileClose(ff);
|
||||
UpdatePixelFormat(Arrows, 64000);
|
||||
|
||||
Icone = (uint16 *)(MemoryArea + GameBytePointer);
|
||||
wordset(Icone, 0, ICONDX * ICONDY);
|
||||
GameBytePointer += (ICONDX * ICONDY * 2);
|
||||
ff = FastFileOpen("icone.bm");
|
||||
GameBytePointer += FastFileRead(ff, (void *)(Icone + ICONDX * ICONDY), FastFileLen(ff));
|
||||
FastFileClose(ff);
|
||||
UpdatePixelFormat(Icone + ICONDX * ICONDY, 500000);
|
||||
GameBytePointer += (ICONDX * ICONDY * 2 * INVICONNUM);
|
||||
|
||||
//
|
||||
TextureArea = (uint8 *)MemoryArea + GameBytePointer;
|
||||
BaseHeadTexture = (uint8 *)(TextureArea);
|
||||
|
||||
ff = FastFileOpen("textur.bm");
|
||||
GameBytePointer += FastFileRead(ff, TextureArea, FastFileLen(ff));
|
||||
FastFileClose(ff);
|
||||
|
||||
// head
|
||||
hh = 0;
|
||||
FTexture[hh]._dx = 300 / 2;
|
||||
FTexture[hh]._dy = 208 / 2;
|
||||
FTexture[hh]._angle = 0;
|
||||
FTexture[hh]._texture = TextureArea;
|
||||
FTexture[hh]._palette = NULL;
|
||||
FTexture[hh]._flag = TEXTUREACTIVE + TEXTURECYLIND;
|
||||
|
||||
// corpo
|
||||
hh = 1;
|
||||
FTexture[hh]._dx = 300;
|
||||
FTexture[hh]._dy = 300;
|
||||
FTexture[hh]._angle = 0;
|
||||
FTexture[hh]._texture = FTexture[0]._texture + (300 * 208) / 4;
|
||||
FTexture[hh]._palette = NULL;
|
||||
FTexture[hh]._flag = TEXTUREACTIVE + TEXTURECYLIND;
|
||||
|
||||
// braccia
|
||||
hh = 2;
|
||||
FTexture[hh]._dx = 300;
|
||||
FTexture[hh]._dy = 150;
|
||||
FTexture[hh]._angle = 0;
|
||||
FTexture[hh]._texture = FTexture[1]._texture + 300 * 300;
|
||||
FTexture[hh]._palette = NULL;
|
||||
FTexture[hh]._flag = TEXTUREACTIVE + TEXTURECYLIND;
|
||||
|
||||
_characterArea = (uint8 *)(MemoryArea + GameBytePointer);
|
||||
GameBytePointer += ReadActor("jm.om", (uint8 *)_characterArea);
|
||||
|
||||
_actor._vertexNum = VertexNum;
|
||||
_actor._faceNum = FaceNum;
|
||||
_actor._light = (struct SLight *)&VLight;
|
||||
_actor._lightNum = LightNum;
|
||||
_actor._camera = (struct SCamera *)&FCamera;
|
||||
_actor._texture = (struct STexture *)&FTexture[0];
|
||||
|
||||
TextArea = (uint8 *)(MemoryArea + GameBytePointer);
|
||||
GameBytePointer += MAXTEXTAREA;
|
||||
|
||||
// icone area
|
||||
SmackBuffer[2] = (uint8 *)(MemoryArea + GameBytePointer);
|
||||
GameBytePointer += ICONDX * ICONDY;
|
||||
// zbuffer
|
||||
ZBuffer = (int16 *)(MemoryArea + GameBytePointer);
|
||||
GameBytePointer += (ZBUFFERSIZE);
|
||||
for (int c = 0; c < (ZBUFFERSIZE / 2); c++)
|
||||
ZBuffer[c] = 0x7FFF;
|
||||
// CDBuffer
|
||||
SpeechBuf[0] = (uint8 *)(MemoryArea + GameBytePointer);
|
||||
SpeechBuf[1] = (uint8 *)(MemoryArea + GameBytePointer);
|
||||
ExtraObj2C = (uint16 *)SpeechBuf[0]; // for room 2C
|
||||
GameBytePointer += SPEECHSIZE;
|
||||
// omino e full motions area
|
||||
SmackBuffer[1] = (uint8 *)(MemoryArea + GameBytePointer);
|
||||
ExtraObj41D = (uint16 *)SmackBuffer[1]; // for room 41D
|
||||
GameBytePointer += SCREENLEN * AREA;
|
||||
// omino buffer
|
||||
SmackTempBuffer[1] = (uint8 *)(MemoryArea + GameBytePointer);
|
||||
GameBytePointer += SMKANBUFFER;
|
||||
// background buffer
|
||||
SmackTempBuffer[0] = (uint8 *)(MemoryArea + GameBytePointer);
|
||||
GameBytePointer += SMKBKGBUFFER;
|
||||
// icone buffer
|
||||
SmackTempBuffer[2] = (uint8 *)(MemoryArea + GameBytePointer);
|
||||
GameBytePointer += SMKICONBUFFER;
|
||||
// background area
|
||||
SmackBuffer[0] = (uint8 *)(MemoryArea + GameBytePointer);
|
||||
GameBytePointer += SCREENLEN * AREA;
|
||||
// SmackImagePointer
|
||||
SmackImagePointer = (uint16 *)(MemoryArea + GameBytePointer);
|
||||
GameBytePointer += SCREENLEN * AREA * 2;
|
||||
|
||||
Video2 = (uint16 *)(MemoryArea + GameBytePointer);
|
||||
|
||||
if (!SemMouseEnabled)
|
||||
Mouse(2); // SPEGNI
|
||||
|
||||
wordset(Video2, 0, 1280L * 480L);
|
||||
ShowScreen(0, 0, 640, 480);
|
||||
|
||||
memset(OldObjStatus, 0, MAXOBJINROOM);
|
||||
memset(VideoObjStatus, 0, MAXOBJINROOM);
|
||||
}
|
||||
|
||||
/*-----------------13/09/95 11.59-------------------
|
||||
ReadActor
|
||||
--------------------------------------------------*/
|
||||
uint32 ReadActor(const char *filename, uint8 *Area) {
|
||||
int32 Read;
|
||||
int32 ActionNum;
|
||||
|
||||
extern uint32 materials[21][181];
|
||||
extern uint16 _textureMat[256][91];
|
||||
extern int16 _textureCoord[MAXFACE][3][2];
|
||||
|
||||
UpdatePixelFormat((uint16 *)_textureMat, 256 * 91);
|
||||
|
||||
ff = FastFileOpen(filename);
|
||||
if (ff == NULL)
|
||||
CloseSys(_sysSent[1]);
|
||||
|
||||
FastFileRead(ff, &ActionNum, 4);
|
||||
|
||||
FastFileRead(ff, &VertexNum, 4);
|
||||
_actor._vertexNum = VertexNum;
|
||||
|
||||
_actor._vertex = (struct SVertex *)(Area);
|
||||
_characterArea = Area;
|
||||
|
||||
Read = FastFileRead(ff, _actor._vertex, sizeof(struct SVertex) * VertexNum * ActionNum);
|
||||
|
||||
FastFileRead(ff, &FaceNum, 4);
|
||||
_actor._faceNum = FaceNum;
|
||||
|
||||
Area += Read;
|
||||
_actor._face = (struct SFace *)(Area);
|
||||
Read += FastFileRead(ff, _actor._face, sizeof(struct SFace) * FaceNum);
|
||||
FastFileClose(ff);
|
||||
|
||||
ff = FastFileOpen("mat.tex");
|
||||
FastFileRead(ff, _textureMat, 2 * 91 * 256);
|
||||
UpdatePixelFormat((uint16 *)_textureMat, 91 * 256);
|
||||
FastFileRead(ff, _textureCoord, 2 * MAXFACE * 3 * 2);
|
||||
FastFileRead(ff, _actor._face, sizeof(struct SFace)*FaceNum);
|
||||
FastFileClose(ff);
|
||||
|
||||
_actor._curFrame = 0;
|
||||
_actor._curAction = hSTAND;
|
||||
|
||||
// fixup Microprose head correction
|
||||
{
|
||||
#define P1 306
|
||||
#define P2 348
|
||||
#define P3 288
|
||||
extern float _vertsCorr[104][3];
|
||||
extern int _vertsCorrList[84];
|
||||
double v1[3], v2[3], v[3], q[3], m1[3][3], m2[3][3], s;
|
||||
struct SVertex *sv;
|
||||
int b, c, d, e, f;
|
||||
|
||||
v1[0] = _actor._vertex[P2]._x - _actor._vertex[P1]._x;
|
||||
v1[1] = _actor._vertex[P2]._y - _actor._vertex[P1]._y;
|
||||
v1[2] = _actor._vertex[P2]._z - _actor._vertex[P1]._z;
|
||||
s = sqrt(v1[0] * v1[0] + v1[1] * v1[1] + v1[2] * v1[2]);
|
||||
v1[0] /= s;
|
||||
v1[1] /= s;
|
||||
v1[2] /= s;
|
||||
|
||||
v2[0] = _actor._vertex[P3]._x - _actor._vertex[P1]._x;
|
||||
v2[1] = _actor._vertex[P3]._y - _actor._vertex[P1]._y;
|
||||
v2[2] = _actor._vertex[P3]._z - _actor._vertex[P1]._z;
|
||||
s = sqrt(v2[0] * v2[0] + v2[1] * v2[1] + v2[2] * v2[2]);
|
||||
v2[0] /= s;
|
||||
v2[1] /= s;
|
||||
v2[2] /= s;
|
||||
|
||||
m1[1][0] = v2[1] * v1[2] - v1[1] * v2[2];
|
||||
m1[1][1] = v2[2] * v1[0] - v1[2] * v2[0];
|
||||
m1[1][2] = v2[0] * v1[1] - v1[0] * v2[1];
|
||||
s = sqrt(m1[1][0] * m1[1][0] + m1[1][1] * m1[1][1] + m1[1][2] * m1[1][2]);
|
||||
m1[1][0] /= s;
|
||||
m1[1][1] /= s;
|
||||
m1[1][2] /= s;
|
||||
|
||||
m1[2][0] = m1[1][1] * v1[2] - v1[1] * m1[1][2];
|
||||
m1[2][1] = m1[1][2] * v1[0] - v1[2] * m1[1][0];
|
||||
m1[2][2] = m1[1][0] * v1[1] - v1[0] * m1[1][1];
|
||||
s = sqrt(m1[2][0] * m1[2][0] + m1[2][1] * m1[2][1] + m1[2][2] * m1[2][2]);
|
||||
m1[2][0] /= s;
|
||||
m1[2][1] /= s;
|
||||
m1[2][2] /= s;
|
||||
|
||||
m1[0][0] = v1[0];
|
||||
m1[0][1] = v1[1];
|
||||
m1[0][2] = v1[2];
|
||||
|
||||
for (b = 0; b < ActionNum; b++) {
|
||||
sv = (struct SVertex *)(_actor._vertex + b * VertexNum);
|
||||
|
||||
v1[0] = sv[P2]._x - sv[P1]._x;
|
||||
v1[1] = sv[P2]._y - sv[P1]._y;
|
||||
v1[2] = sv[P2]._z - sv[P1]._z;
|
||||
s = sqrt(v1[0] * v1[0] + v1[1] * v1[1] + v1[2] * v1[2]);
|
||||
v1[0] /= s;
|
||||
v1[1] /= s;
|
||||
v1[2] /= s;
|
||||
|
||||
v2[0] = sv[P3]._x - sv[P1]._x;
|
||||
v2[1] = sv[P3]._y - sv[P1]._y;
|
||||
v2[2] = sv[P3]._z - sv[P1]._z;
|
||||
s = sqrt(v2[0] * v2[0] + v2[1] * v2[1] + v2[2] * v2[2]);
|
||||
v2[0] /= s;
|
||||
v2[1] /= s;
|
||||
v2[2] /= s;
|
||||
|
||||
m2[1][0] = v2[1] * v1[2] - v1[1] * v2[2];
|
||||
m2[1][1] = v2[2] * v1[0] - v1[2] * v2[0];
|
||||
m2[1][2] = v2[0] * v1[1] - v1[0] * v2[1];
|
||||
s = sqrt(m2[1][0] * m2[1][0] + m2[1][1] * m2[1][1] + m2[1][2] * m2[1][2]);
|
||||
m2[1][0] /= s;
|
||||
m2[1][1] /= s;
|
||||
m2[1][2] /= s;
|
||||
|
||||
m2[2][0] = m2[1][1] * v1[2] - v1[1] * m2[1][2];
|
||||
m2[2][1] = m2[1][2] * v1[0] - v1[2] * m2[1][0];
|
||||
m2[2][2] = m2[1][0] * v1[1] - v1[0] * m2[1][1];
|
||||
s = sqrt(m2[2][0] * m2[2][0] + m2[2][1] * m2[2][1] + m2[2][2] * m2[2][2]);
|
||||
m2[2][0] /= s;
|
||||
m2[2][1] /= s;
|
||||
m2[2][2] /= s;
|
||||
|
||||
m2[0][0] = v1[0];
|
||||
m2[0][1] = v1[1];
|
||||
m2[0][2] = v1[2];
|
||||
|
||||
v2[0] = sv[P1]._x;
|
||||
v2[1] = sv[P1]._y;
|
||||
v2[2] = sv[P1]._z;
|
||||
|
||||
v1[0] = _actor._vertex[P1]._x;
|
||||
v1[1] = _actor._vertex[P1]._y;
|
||||
v1[2] = _actor._vertex[P1]._z;
|
||||
|
||||
for (e = 279; e < 383; e++) {
|
||||
for (f = 0; f < 84; f++)
|
||||
if (_vertsCorrList[f] == e)
|
||||
break;
|
||||
if (f == 84)
|
||||
continue;
|
||||
|
||||
v[0] = _vertsCorr[e - 279][0];
|
||||
v[1] = _vertsCorr[e - 279][2];
|
||||
v[2] = _vertsCorr[e - 279][1];
|
||||
|
||||
q[0] = 0.0;
|
||||
q[1] = 0.0;
|
||||
q[2] = 0.0;
|
||||
for (d = 0; d < 3; d++)
|
||||
for (c = 0; c < 3; c++)
|
||||
q[c] += m1[c][d] * v[d];
|
||||
v[0] = 0.0;
|
||||
v[1] = 0.0;
|
||||
v[2] = 0.0;
|
||||
for (d = 0; d < 3; d++)
|
||||
for (c = 0; c < 3; c++)
|
||||
v[c] += m2[d][c] * q[d];
|
||||
|
||||
if (b < 42) {
|
||||
sv[e]._x += _vertsCorr[e - 279][0];
|
||||
sv[e]._y += _vertsCorr[e - 279][2];
|
||||
sv[e]._z += _vertsCorr[e - 279][1];
|
||||
} else {
|
||||
sv[e]._x += v[0];
|
||||
sv[e]._y += v[1];
|
||||
sv[e]._z += v[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (Read + 8 + 4);
|
||||
}
|
||||
|
||||
/* -----------------27/06/97 17.52-------------------
|
||||
actionInRoom
|
||||
--------------------------------------------------*/
|
||||
int actionInRoom(int curA) {
|
||||
int b;
|
||||
|
||||
for (b = 0; b < MAXACTIONINROOM; b++) {
|
||||
if (Room[_curRoom]._actions[b] == curA)
|
||||
break;
|
||||
}
|
||||
|
||||
if (b >= MAXACTIONINROOM) {
|
||||
warning("Action %d not found in room %d", curA, _curRoom);
|
||||
return (0) ;
|
||||
}
|
||||
|
||||
return (b);
|
||||
}
|
||||
|
||||
int RoomReady = 0;
|
||||
/*-----------------17/02/95 10.19-------------------
|
||||
ReadLoc
|
||||
--------------------------------------------------*/
|
||||
void ReadLoc() {
|
||||
extern uint16 _playingAnims[];
|
||||
|
||||
RoomReady = 0;
|
||||
if ((_curRoom == r11) && !(Room[r11]._flag & OBJFLAG_DONE))
|
||||
SemShowHomo = 1;
|
||||
|
||||
SoundFadOut();
|
||||
|
||||
memset(Video2, 0, TotalMemory - GameBytePointer);
|
||||
|
||||
GameWordPointer = (CurRoomMaxX * MAXY); // space for Video2
|
||||
|
||||
sprintf(UStr, "%s.cr", Room[_curRoom]._baseName);
|
||||
ImagePointer = (uint16 *)Video2 + GameWordPointer - 4;
|
||||
|
||||
GameWordPointer += (DecCR(UStr, (uint8 *)ImagePointer, (uint8 *)Video2) + 1) / 2;
|
||||
memcpy(&BmInfo, (struct SBmInfo *)ImagePointer, sizeof(struct SBmInfo));
|
||||
ImagePointer += 4;
|
||||
UpdatePixelFormat(ImagePointer, BmInfo.dx * BmInfo.dy);
|
||||
|
||||
ReadObj();
|
||||
if ((Room[_curRoom]._sounds[0] != 0)) ReadSounds();
|
||||
|
||||
sprintf(UStr, "%s.3d", Room[_curRoom]._baseName);
|
||||
_actionPointer[0] = (uint8 *)(Video2 + GameWordPointer);
|
||||
GameWordPointer += read3D(UStr) / 2;
|
||||
|
||||
sprintf(UStr, "act\\%s.act", Room[_curRoom]._baseName);
|
||||
// ReadAction( UStr );
|
||||
|
||||
wordset(Video2, 0, CurRoomMaxX * MAXY);
|
||||
MCopy(Video2 + TOP * CurRoomMaxX, ImagePointer, CurRoomMaxX * AREA);
|
||||
|
||||
CurSortTableNum = 0;
|
||||
memset(OldObjStatus, 0, MAXOBJINROOM);
|
||||
memset(VideoObjStatus, 0, MAXOBJINROOM);
|
||||
|
||||
RegenRoom();
|
||||
|
||||
if (Room[_curRoom]._bkgAnim) {
|
||||
wordcopy(SmackImagePointer, ImagePointer, MAXX * AREA);
|
||||
StartSmackAnim(Room[_curRoom]._bkgAnim);
|
||||
} else
|
||||
StopSmackAnim(_playingAnims[0]);
|
||||
|
||||
InitAtFrameHandler(Room[_curRoom]._bkgAnim, 0);
|
||||
|
||||
if (MaxMemory < (GameWordPointer * 2 + GameBytePointer))
|
||||
MaxMemory = (GameWordPointer * 2 + GameBytePointer);
|
||||
}
|
||||
|
||||
/*-----------------10/12/95 14.59-------------------
|
||||
TendIn
|
||||
--------------------------------------------------*/
|
||||
void TendIn() {
|
||||
// int a;
|
||||
|
||||
TextStatus = TEXT_OFF;
|
||||
|
||||
if (_curRoom == rINTRO) {
|
||||
PlayDialog(dFLOG);
|
||||
return ;
|
||||
}
|
||||
|
||||
SemPaintHomo = 1;
|
||||
WaitSoundFadEnd();
|
||||
PaintScreen(1);
|
||||
|
||||
ShowScreen(0, 0, MAXX, MAXY);
|
||||
RoomReady = 1;
|
||||
// for( a=0; a<MAXY; a++ )
|
||||
// VCopy(a*VirtualPageLen+VideoScrollPageDx,Video2+a*CurRoomMaxX+CurScrollPageDx,VirtualPageLen);
|
||||
// UnlockVideo();
|
||||
}
|
||||
|
||||
/*-----------------17/02/95 10.20-------------------
|
||||
ReadObj
|
||||
--------------------------------------------------*/
|
||||
void ReadObj() {
|
||||
if (Room[_curRoom]._object[0]) {
|
||||
uint16 *o = (uint16 *)ImagePointer + BmInfo.dx * BmInfo.dy;
|
||||
|
||||
uint32 b = 0;
|
||||
for (uint16 a = 0; a < MAXOBJINROOM; a++) {
|
||||
uint16 c = Room[_curRoom]._object[a];
|
||||
if (!c)
|
||||
break;
|
||||
|
||||
if ((_curRoom == r41D) && (a == 89))
|
||||
break;
|
||||
else if ((_curRoom == r2C) && (a == 20))
|
||||
break;
|
||||
|
||||
if (_obj[c]._mode & OBJMODE_FULL) {
|
||||
wordcopy(&BmInfo, o + b, 4);
|
||||
b += 4;
|
||||
_obj[c]._px = BmInfo.px;
|
||||
_obj[c]._py = BmInfo.py;
|
||||
_obj[c]._dx = BmInfo.dx;
|
||||
_obj[c]._dy = BmInfo.dy;
|
||||
|
||||
ObjPointers[a] = (uint16 *)(o + b);
|
||||
UpdatePixelFormat(ObjPointers[a], (_obj[c]._dx * _obj[c]._dy));
|
||||
b += (_obj[c]._dx * _obj[c]._dy);
|
||||
}
|
||||
|
||||
if ((_obj[c]._mode & OBJMODE_MASK)) {
|
||||
wordcopy(&BmInfo, o + b, 4);
|
||||
b += 4;
|
||||
_obj[c]._px = BmInfo.px;
|
||||
_obj[c]._py = BmInfo.py;
|
||||
_obj[c]._dx = BmInfo.dx;
|
||||
_obj[c]._dy = BmInfo.dy;
|
||||
|
||||
uint32 *p = (uint32 *)(o + b);
|
||||
ObjPointers[a] = (uint16 *)p + 2;
|
||||
UpdatePixelFormat(ObjPointers[a], *p);
|
||||
|
||||
b += (p[0]);
|
||||
b += 2;
|
||||
|
||||
p = (uint32 *)(o + b);
|
||||
MaskPointers[a] = (uint8 *)p + 4;
|
||||
b += (*p / 2);
|
||||
b += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------17/02/95 10.20-------------------
|
||||
ReadObj
|
||||
--------------------------------------------------*/
|
||||
void ReadExtraObj2C() {
|
||||
if (Room[_curRoom]._object[32]) {
|
||||
uint16 *o = (uint16 *)ExtraObj2C;
|
||||
ff = FastFileOpen("2C2.bm");
|
||||
FastFileRead(ff, ExtraObj2C, FastFileLen(ff));
|
||||
FastFileClose(ff);
|
||||
|
||||
uint32 b = 0;
|
||||
for (uint16 a = 20; a < MAXOBJINROOM; a++) {
|
||||
uint16 c = Room[_curRoom]._object[a];
|
||||
if (!c)
|
||||
break;
|
||||
|
||||
if (_obj[c]._mode & OBJMODE_FULL) {
|
||||
wordcopy(&BmInfo, o + b, 4);
|
||||
b += 4;
|
||||
_obj[c]._px = BmInfo.px;
|
||||
_obj[c]._py = BmInfo.py;
|
||||
_obj[c]._dx = BmInfo.dx;
|
||||
_obj[c]._dy = BmInfo.dy;
|
||||
|
||||
ObjPointers[a] = (uint16 *)(o + b);
|
||||
UpdatePixelFormat(ObjPointers[a], (_obj[c]._dx * _obj[c]._dy));
|
||||
b += (_obj[c]._dx * _obj[c]._dy);
|
||||
}
|
||||
|
||||
if ((_obj[c]._mode & OBJMODE_MASK)) {
|
||||
wordcopy(&BmInfo, o + b, 4);
|
||||
b += 4;
|
||||
_obj[c]._px = BmInfo.px;
|
||||
_obj[c]._py = BmInfo.py;
|
||||
_obj[c]._dx = BmInfo.dx;
|
||||
_obj[c]._dy = BmInfo.dy;
|
||||
|
||||
uint32 *p = (uint32 *)(o + b);
|
||||
ObjPointers[a] = (uint16 *)p + 2;
|
||||
UpdatePixelFormat(ObjPointers[a], *p);
|
||||
|
||||
b += (p[0]);
|
||||
b += 2;
|
||||
|
||||
p = (uint32 *)(o + b);
|
||||
MaskPointers[a] = (uint8 *)p + 4;
|
||||
b += (*p / 2);
|
||||
b += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------17/02/95 10.20-------------------
|
||||
ReadObj
|
||||
--------------------------------------------------*/
|
||||
void ReadExtraObj41D() {
|
||||
if (Room[_curRoom]._object[32]) {
|
||||
uint16 *o = (uint16 *)ExtraObj41D;
|
||||
ff = FastFileOpen("41D2.bm");
|
||||
FastFileRead(ff, ExtraObj41D, FastFileLen(ff));
|
||||
FastFileClose(ff);
|
||||
|
||||
uint32 b = 0;
|
||||
for (uint16 a = 89; a < MAXOBJINROOM; a++) {
|
||||
uint16 c = Room[_curRoom]._object[a];
|
||||
if (!c)
|
||||
break;
|
||||
|
||||
if (_obj[c]._mode & OBJMODE_FULL) {
|
||||
wordcopy(&BmInfo, o + b, 4);
|
||||
b += 4;
|
||||
_obj[c]._px = BmInfo.px;
|
||||
_obj[c]._py = BmInfo.py;
|
||||
_obj[c]._dx = BmInfo.dx;
|
||||
_obj[c]._dy = BmInfo.dy;
|
||||
|
||||
ObjPointers[a] = (uint16 *)(o + b);
|
||||
UpdatePixelFormat(ObjPointers[a], (_obj[c]._dx * _obj[c]._dy));
|
||||
b += (_obj[c]._dx * _obj[c]._dy);
|
||||
}
|
||||
|
||||
if ((_obj[c]._mode & OBJMODE_MASK)) {
|
||||
wordcopy(&BmInfo, o + b, 4);
|
||||
b += 4;
|
||||
_obj[c]._px = BmInfo.px;
|
||||
_obj[c]._py = BmInfo.py;
|
||||
_obj[c]._dx = BmInfo.dx;
|
||||
_obj[c]._dy = BmInfo.dy;
|
||||
|
||||
uint32 *p = (uint32 *)(o + b);
|
||||
ObjPointers[a] = (uint16 *)p + 2;
|
||||
UpdatePixelFormat(ObjPointers[a], *p);
|
||||
|
||||
b += (p[0]);
|
||||
b += 2;
|
||||
|
||||
p = (uint32 *)(o + b);
|
||||
MaskPointers[a] = (uint8 *)p + 4;
|
||||
b += (*p / 2);
|
||||
b += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------12/12/95 11.39-------------------
|
||||
ReadSounds
|
||||
--------------------------------------------------*/
|
||||
void ReadSounds() {
|
||||
if (!SoundSystemActive)
|
||||
return;
|
||||
|
||||
for (uint16 a = 0; a < MAXSOUNDSINROOM; a++) {
|
||||
uint16 b = Room[_curRoom]._sounds[a];
|
||||
|
||||
if (b == 0)
|
||||
break;
|
||||
|
||||
SoundPointer[a] = (uint8 *)(Video2 + GameWordPointer);
|
||||
|
||||
sprintf(UStr, "%s", GSample[b].name);
|
||||
if (!stricmp(UStr, "RUOTE2C.WAV")) break;
|
||||
|
||||
ff = FastFileOpen(UStr);
|
||||
if (ff == NULL)
|
||||
CloseSys(_sysSent[1]);
|
||||
int len = FastFileRead(ff, SoundPointer[a], FastFileLen(ff));
|
||||
FastFileClose(ff);
|
||||
if (LoadAudioWav(b, SoundPointer[a], len))
|
||||
len *= 2;
|
||||
|
||||
GameWordPointer += (len + 1) / 2;
|
||||
|
||||
if (GSample[b].flag & SOUNDFLAG_SBACK)
|
||||
SoundFadIn(b);
|
||||
else if (GSample[b].flag & SOUNDFLAG_SON)
|
||||
NLPlaySound(b);
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------
|
||||
RegenRoom
|
||||
--------------------------------------------------*/
|
||||
void RegenRoom() {
|
||||
for (uint16 a = 0; a < MAXOBJINROOM; a++) {
|
||||
if (Room[_curRoom]._object[a] == 0)
|
||||
break;
|
||||
|
||||
int status = (_obj[Room[_curRoom]._object[a]]._mode & OBJMODE_OBJSTATUS);
|
||||
|
||||
if (status) {
|
||||
if ((!OldObjStatus[a]) && (_obj[Room[_curRoom]._object[a]]._mode & (OBJMODE_MASK | OBJMODE_FULL))) {
|
||||
OldObjStatus[a] = 1;
|
||||
}
|
||||
} else if ((OldObjStatus[a]) && (_obj[Room[_curRoom]._object[a]]._mode & (OBJMODE_MASK | OBJMODE_FULL)))
|
||||
OldObjStatus[a] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------
|
||||
PaintRegenRoom
|
||||
--------------------------------------------------*/
|
||||
void PaintRegenRoom() {
|
||||
for (uint16 a = 0; a < MAXOBJINROOM; a++) {
|
||||
if ((OldObjStatus[a]) && (!VideoObjStatus[a])) {
|
||||
SortTable[ CurSortTableNum ].index = Room[_curRoom]._object[a];
|
||||
SortTable[ CurSortTableNum ].roomindex = a;
|
||||
SortTable[ CurSortTableNum ].togli = false;
|
||||
SortTable[ CurSortTableNum ].framecur = 0;
|
||||
SortTable[ CurSortTableNum ].typology = TYPO_BMP;
|
||||
VideoObjStatus[a] = 1;
|
||||
CurSortTableNum ++;
|
||||
} else if ((!OldObjStatus[a]) && (VideoObjStatus[a])) {
|
||||
SortTable[ CurSortTableNum ].index = Room[_curRoom]._object[a];
|
||||
SortTable[ CurSortTableNum ].roomindex = a;
|
||||
SortTable[ CurSortTableNum ].togli = true;
|
||||
SortTable[ CurSortTableNum ].framecur = 0;
|
||||
SortTable[ CurSortTableNum ].typology = TYPO_BMP;
|
||||
VideoObjStatus[a] = 0;
|
||||
CurSortTableNum ++;
|
||||
}
|
||||
|
||||
}
|
||||
memcpy(VideoObjStatus, OldObjStatus, MAXOBJINROOM);
|
||||
}
|
||||
/*-----------------16/05/95 11.03-------------------
|
||||
DrawObj
|
||||
--------------------------------------------------*/
|
||||
void DrawObj(struct SDObj d) {
|
||||
uint16 b;
|
||||
|
||||
for (uint16 a = 0; a < 4; a++) {
|
||||
if (d.l[a] > (CurRoomMaxX)) {
|
||||
//printf("%u %u %u %u\n",d.l[0],d.l[1],d.l[2],d.l[3]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
uint16 *buf = d.buf;
|
||||
if (d.flag & DRAWMASK) {
|
||||
uint8 *mask = d.mask;
|
||||
|
||||
if (d.flag & COPYTORAM) {
|
||||
for (b = d.y; b < (d.y + d.dy); b++) {
|
||||
uint16 Sco = 0;
|
||||
uint16 c = 0;
|
||||
while (Sco < d.dx) {
|
||||
if (c == 0) { /* salta */
|
||||
Sco += *mask;
|
||||
mask++;
|
||||
|
||||
c = 1;
|
||||
} else { // copia
|
||||
uint16 Now = *mask;
|
||||
|
||||
if ((Now != 0) && (b >= (d.y + d.l[1])) && (b < (d.y + d.l[3]))) {
|
||||
if ((Sco >= d.l[0]) && ((Sco + Now) < d.l[2]))
|
||||
MCopy(Video2 + (b * CurRoomMaxX) + Sco + d.x, buf, Now);
|
||||
|
||||
else if ((Sco < d.l[0]) && ((Sco + Now) < d.l[2]) && ((Sco + Now) >= d.l[0]))
|
||||
MCopy(Video2 + (b * CurRoomMaxX) + d.l[0] + d.x, buf + d.l[0] - Sco, (Now + Sco - d.l[0]));
|
||||
|
||||
else if ((Sco >= d.l[0]) && ((Sco + Now) >= d.l[2]) && (Sco < d.l[2]))
|
||||
MCopy(Video2 + (b * CurRoomMaxX) + Sco + d.x, buf, (d.l[2] - Sco));
|
||||
|
||||
else if ((Sco < d.l[0]) && ((Sco + Now) >= d.l[2]))
|
||||
MCopy(Video2 + (b * CurRoomMaxX) + d.l[0] + d.x, buf + d.l[0] - Sco, (d.l[2] - d.l[0]));
|
||||
}
|
||||
Sco += *mask;
|
||||
buf += *mask++;
|
||||
c = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (d.flag & COPYTOVIDEO)
|
||||
CloseSys(_sysSent[5]);
|
||||
} else {
|
||||
if (d.flag & COPYTORAM) {
|
||||
for (b = d.l[1]; b < d.l[3]; b++) {
|
||||
MCopy(Video2 + (d.y + b)*CurRoomMaxX + (d.x + d.l[0]),
|
||||
buf + (b * d.dx) + d.l[0], (d.l[2] - d.l[0]));
|
||||
}
|
||||
}
|
||||
|
||||
if (d.flag & COPYTOVIDEO) {
|
||||
for (b = d.l[1]; b < d.l[3]; b++) {
|
||||
VCopy((d.y + b)*VirtualPageLen + (d.x + d.l[0]),
|
||||
buf + (b * d.dx) + d.l[0], d.l[2] - d.l[0]);
|
||||
}
|
||||
|
||||
UnlockVideo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------27/02/95 22.16-------------------
|
||||
RegenInventory()
|
||||
--------------------------------------------------*/
|
||||
void RegenInventory(uint8 StartIcon, uint8 StartLine) {
|
||||
uint16 a, b;
|
||||
|
||||
if (StartLine > ICONDY) StartLine = ICONDY;
|
||||
|
||||
for (b = 0; b < ICONDY; b++)
|
||||
wordset(Video2 + (FIRSTLINE + b)*CurRoomMaxX + CurScrollPageDx, 0, SCREENLEN);
|
||||
|
||||
for (a = 0; a < ICONSHOWN; a++) {
|
||||
if ((_inventory[a + StartIcon] >= LASTICON) /*|| ( _inventory[a+StartIcon] == iEMPTYSLOT )*/) {
|
||||
for (b = 0; b < (ICONDY - StartLine); b++)
|
||||
MCopy(Video2 + (FIRSTLINE + b)*CurRoomMaxX + a * (ICONDX) + ICONMARGSX + CurScrollPageDx,
|
||||
Icone + (_inventory[a + StartIcon] - LASTICON + READICON + 1)*ICONDX * ICONDY + (b + StartLine)*ICONDX, ICONDX);
|
||||
} else if (_inventory[a + StartIcon] != LightIcon) {
|
||||
for (b = 0; b < (ICONDY - StartLine); b++)
|
||||
MCopy(Video2 + (FIRSTLINE + b)*CurRoomMaxX + a * (ICONDX) + ICONMARGSX + CurScrollPageDx,
|
||||
Icone + _inventory[a + StartIcon]*ICONDX * ICONDY + (b + StartLine)*ICONDX, ICONDX);
|
||||
}
|
||||
}
|
||||
|
||||
// frecce
|
||||
if (StartIcon != 0) { // COPIA LA SINISTRA
|
||||
LeftArrow = ICONMARGSX * ICONDY * 3;
|
||||
for (b = 0; b < (ICONDY - StartLine); b++) {
|
||||
MCopy(Video2 + (FIRSTLINE + b)*CurRoomMaxX + CurScrollPageDx,
|
||||
Arrows + LeftArrow + (b + StartLine)*ICONMARGSX, ICONMARGSX);
|
||||
}
|
||||
}
|
||||
|
||||
if ((StartIcon + ICONSHOWN) < _inventorySize) { // COPIA LA DESTRA
|
||||
RightArrow = ICONMARGDX * ICONDY * 2;
|
||||
for (b = 0; b < (ICONDY - StartLine); b++) {
|
||||
MCopy(Video2 + (FIRSTLINE + b)*CurRoomMaxX + CurScrollPageDx + SCREENLEN - ICONMARGDX,
|
||||
Arrows + RightArrow + ICONMARGSX * ICONDY * 2 + (b + StartLine)*ICONMARGSX, ICONMARGSX);
|
||||
}
|
||||
}
|
||||
LeftArrow = 0;
|
||||
RightArrow = 0;
|
||||
|
||||
//RegenSmackIcon( StartIcon, 2 );
|
||||
|
||||
VMouseCopy();
|
||||
for (a = 0; a < ICONDY; a++)
|
||||
VCopy((FIRSTLINE + a)*VirtualPageLen + VideoScrollPageDx,
|
||||
Video2 + (FIRSTLINE + a)*CurRoomMaxX + CurScrollPageDx, SCREENLEN);
|
||||
VMouseRestore();
|
||||
//VMouseON();
|
||||
UnlockVideo();
|
||||
}
|
||||
|
||||
/*-----------------16/05/95 22.08-------------------
|
||||
RGBColor - Torna un rgb a 8 bit da un _color hi
|
||||
--------------------------------------------------*/
|
||||
void RGBColor(uint16 a, uint8 *r, uint8 *g, uint8 *b) {
|
||||
|
||||
*r = (uint8)(((uint16)((uint16)a >> 10L) & 0x1F) << 3);
|
||||
*g = (uint8)(((uint16)((uint16)a >> 5L) & 0x1F) << 3);
|
||||
*b = (uint8)(((uint16)((uint16)a) & 0x1F) << 3);
|
||||
}
|
||||
|
||||
/*-----------------16/05/95 22.08-------------------
|
||||
ColorRGB - Torna il _color hi a un rgb a 8 bit
|
||||
--------------------------------------------------*/
|
||||
uint16 RGB2Color(uint8 r, uint8 g, uint8 b) {
|
||||
r >>= 3;
|
||||
g >>= 3;
|
||||
b >>= 3;
|
||||
|
||||
int16 a = (int16)(((uint16)(b & 0x1F) & 0x1F) +
|
||||
((uint16)((uint16)(g & 0x1F) << 5L) & 0x3E0) +
|
||||
((uint16)((uint16)(r & 0x1F) << 10L) & 0x7C00)
|
||||
);
|
||||
|
||||
return (a);
|
||||
}
|
||||
|
||||
/* -----------------20/11/97 16.59-------------------
|
||||
* ULaw2Linear
|
||||
* --------------------------------------------------*/
|
||||
uint16 ULaw2Linear(uint8 ulawbyte) {
|
||||
static short exp_lut[8] = {0, 132, 396, 924, 1980, 4092, 8316, 16764};
|
||||
|
||||
ulawbyte = ~ulawbyte;
|
||||
short sign = (ulawbyte & 0x80);
|
||||
short exponent = (ulawbyte >> 4) & 0x07;
|
||||
short mantissa = ulawbyte & 0x0F;
|
||||
short sample = exp_lut[exponent] + (mantissa << (exponent + 3));
|
||||
if (sign != 0)
|
||||
sample = -sample;
|
||||
|
||||
return (sample);
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
218
engines/trecision/nl/ll/llvideo.cpp
Normal file
218
engines/trecision/nl/ll/llvideo.cpp
Normal file
@ -0,0 +1,218 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
//#include <dos.h>
|
||||
#include <conio.h>
|
||||
#include "trecision/nl/lib/addtype.h"
|
||||
#include "trecision/nl/sysdef.h"
|
||||
#include "trecision/nl/struct.h"
|
||||
#include "trecision/nl/ll/llinc.h"
|
||||
#include "trecision/nl/extern.h"
|
||||
#include "trecision/nl/define.h"
|
||||
|
||||
#include "graphics/pixelformat.h"
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
// locals
|
||||
extern bool _linearMode;
|
||||
extern Graphics::PixelFormat ScreenFormat;
|
||||
|
||||
/*-----------------07/11/95 15.18-------------------
|
||||
ResetZB
|
||||
--------------------------------------------------*/
|
||||
void ResetZB(int x1, int y1, int x2, int y2) {
|
||||
if (x1 > x2)
|
||||
return;
|
||||
|
||||
if (y1 > y2)
|
||||
return;
|
||||
|
||||
if (((x2 - x1) * (y2 - y1) * 2) > ZBUFFERSIZE)
|
||||
warning("Warning: ZBuffer size %d!\n", (x2 - x1) * (y2 - y1) * 2);
|
||||
|
||||
wordset(ZBuffer, 0x7FFF, (x2 - x1) * (y2 - y1));
|
||||
}
|
||||
|
||||
/*-----------------10/12/95 15.49-------------------
|
||||
VCopy - Esegue copia veloce in Video a 32k
|
||||
--------------------------------------------------*/
|
||||
void VCopy(uint32 Sco, uint16 *Src, uint32 Len) {
|
||||
LockVideo();
|
||||
if ((Video == NULL) || (Len == 0))
|
||||
return ;
|
||||
|
||||
if (_linearMode && ((VideoPitch == 0) || (VideoPitch == SCREENLEN * 2))) {
|
||||
MCopy(Video + Sco, Src, Len);
|
||||
return ;
|
||||
}
|
||||
|
||||
int32 x1 = Sco % SCREENLEN;
|
||||
int32 y1 = Sco / SCREENLEN;
|
||||
|
||||
uint32 EndSco = Sco + Len;
|
||||
|
||||
int32 y2 = EndSco / SCREENLEN;
|
||||
|
||||
uint32 SrcSco = 0;
|
||||
|
||||
uint32 CopyNow;
|
||||
if (Len > SCREENLEN - x1)
|
||||
CopyNow = SCREENLEN - x1;
|
||||
else
|
||||
CopyNow = Len;
|
||||
|
||||
MCopy(Video + y1 * (VideoPitch / 2) + x1, Src + SrcSco, CopyNow);
|
||||
SrcSco += CopyNow;
|
||||
Len -= CopyNow;
|
||||
|
||||
for (int32 i = (y1 + 1); i <= (y2 - 1); i++) {
|
||||
CopyNow = SCREENLEN;
|
||||
MCopy(Video + i * (VideoPitch / 2), Src + SrcSco, CopyNow);
|
||||
SrcSco += CopyNow;
|
||||
Len -= CopyNow;
|
||||
}
|
||||
|
||||
if (Len > 0) {
|
||||
CopyNow = Len;
|
||||
MCopy(Video + y2 * (VideoPitch / 2), Src + SrcSco, CopyNow);
|
||||
// Useless assignment, removed
|
||||
// SrcSco += CopyNow;
|
||||
// Len -= CopyNow;
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------10/12/95 15.51-------------------
|
||||
MCopy - Esegue copia veloce in memoria
|
||||
--------------------------------------------------*/
|
||||
void MCopy(uint16 *Dest, uint16 *Src, uint32 Len) {
|
||||
if (Len & 1) {
|
||||
*Dest++ = *Src++;
|
||||
Len --;
|
||||
}
|
||||
longcopy(Dest, Src, (Len >> 1));
|
||||
}
|
||||
|
||||
/*-----------------10/12/95 15.52-------------------
|
||||
ShowScreen
|
||||
--------------------------------------------------*/
|
||||
void ShowScreen(int px, int py, int dx, int dy) {
|
||||
for (int a = 0; a < dy; a++)
|
||||
VCopy(px + (py + a)*VirtualPageLen + VideoScrollPageDx,
|
||||
Video2 + px + (py + a)*CurRoomMaxX + CurScrollPageDx,
|
||||
dx);
|
||||
|
||||
UnlockVideo();
|
||||
}
|
||||
|
||||
/* -----------------12/06/97 18.25-------------------
|
||||
UpdatePixelFormat
|
||||
--------------------------------------------------*/
|
||||
void UpdatePixelFormat(uint16 *p, uint32 len) {
|
||||
uint8 r, g, b;
|
||||
|
||||
for (int a = 0; a < len; a++) {
|
||||
uint16 t = p[a];
|
||||
RGBColor(t, &r, &g, &b);
|
||||
p[a] = ScreenFormat.RGBToColor(r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------12/06/97 18.25-------------------
|
||||
UnUpdatePixelFormat
|
||||
--------------------------------------------------*/
|
||||
uint16 UnUpdatePixelFormat(uint16 t) {
|
||||
uint8 r, g, b;
|
||||
ScreenFormat.colorToRGB(t, r, g, b);
|
||||
return (RGB2Color(r, g, b));
|
||||
}
|
||||
|
||||
/*-----------------10/12/95 15.53-------------------
|
||||
CheckMask - Compreso
|
||||
--------------------------------------------------*/
|
||||
LLBOOL CheckMask(uint16 MX, uint16 my) {
|
||||
for (int8 a = (MAXOBJINROOM - 1); a >= 0; a--) {
|
||||
|
||||
uint16 CheckedObj = Room[_curRoom]._object[a];
|
||||
|
||||
if ((CheckedObj) && (_obj[CheckedObj]._mode & (OBJMODE_OBJSTATUS))) {
|
||||
if ((MX >= _obj[CheckedObj]._lim[0]) &&
|
||||
(my >= _obj[CheckedObj]._lim[1] + TOP) &&
|
||||
(MX <= _obj[CheckedObj]._lim[2]) &&
|
||||
(my <= _obj[CheckedObj]._lim[3] + TOP)) {
|
||||
|
||||
if (_obj[CheckedObj]._mode & OBJMODE_FULL) {
|
||||
_curObj = CheckedObj;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_obj[CheckedObj]._mode & OBJMODE_LIM) {
|
||||
_curObj = CheckedObj;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_obj[CheckedObj]._mode & OBJMODE_MASK) {
|
||||
uint8 *mask = MaskPointers[a];
|
||||
int16 d = _obj[CheckedObj]._px;
|
||||
|
||||
for (int16 b = _obj[CheckedObj]._py; b < (_obj[CheckedObj]._py + _obj[CheckedObj]._dy); b++) {
|
||||
int16 c = 0;
|
||||
int16 e = 0;
|
||||
while (e < _obj[CheckedObj]._dx) {
|
||||
if (!c) { // fuori oggetto
|
||||
if ((b + TOP) == my) {
|
||||
if ((MX >= (d + e)) && (MX < (d + e + *mask))) {
|
||||
_curObj = 0;
|
||||
// cosi' non cerca piu' return false;
|
||||
}
|
||||
}
|
||||
|
||||
e += *mask;
|
||||
mask++;
|
||||
c = 1;
|
||||
} else { // dentro oggetto
|
||||
if ((b + TOP) == my) {
|
||||
if ((MX >= (d + e)) && (MX < (d + e + *mask))) {
|
||||
_curObj = CheckedObj;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
e += *mask;
|
||||
mask++;
|
||||
c = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_curObj = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
255
engines/trecision/nl/message.h
Normal file
255
engines/trecision/nl/message.h
Normal file
@ -0,0 +1,255 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
DEFINIZIONI MESSAGGI
|
||||
|
||||
*/
|
||||
|
||||
/*************************************************************************
|
||||
* PRIORITA' *
|
||||
*************************************************************************/
|
||||
#define MP_SYSTEM 255 /* PRIORITA' ASSOLUTA */
|
||||
|
||||
#define MP_LOW 1
|
||||
#define MP_MED 64
|
||||
#define MP_HIGH 128
|
||||
#define MP_DEFAULT MP_MED
|
||||
|
||||
/*************************************************************************
|
||||
* CLASSI ED EVENTI *
|
||||
* *
|
||||
* MC Message Classes Notify *
|
||||
* ME Message Events Notify *
|
||||
*************************************************************************/
|
||||
#define CLASS_GAME 63 // 0- 63 --> coda GAME
|
||||
#define CLASS_ANIM 127 // 64-127 --> coda ANIM
|
||||
#define CLASS_HOMO 255 // 128-255 --> coda HOMO
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* IDLE *
|
||||
*************************************************************************/
|
||||
#define MC_IDLE 0
|
||||
|
||||
/*************************************************************************
|
||||
* MOUSE *
|
||||
*************************************************************************/
|
||||
/* Mouse events */
|
||||
#define MC_MOUSE 1
|
||||
|
||||
#define ME_MLEFT 0 // (mx,my,...)
|
||||
#define ME_MRIGHT 1 // (mx,my,...)
|
||||
#define ME_MTOGHETHER 2 // (mx,my,...)
|
||||
#define ME_MMOVE 3 // (mx,my,direction,...)
|
||||
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* SYSTEM *
|
||||
*************************************************************************/
|
||||
/* System events */
|
||||
#define MC_SYSTEM 2
|
||||
|
||||
#define ME_QUIT 0
|
||||
#define ME_START 1
|
||||
#define ME_SAVEGAME 2
|
||||
#define ME_LOADGAME 3
|
||||
#define ME_CHANGEROOM 4 // (room,door,...)
|
||||
#define ME_WAITANIMDEL 5
|
||||
#define ME_WAITANIMADD 6
|
||||
#define ME_REDRAWROOM 7
|
||||
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* Inventory *
|
||||
*************************************************************************/
|
||||
/* Inventory events */
|
||||
#define MC_INVENTORY 3
|
||||
|
||||
#define ME_OPEN 0
|
||||
#define ME_CLOSE 1
|
||||
#define ME_PAINT 2
|
||||
#define ME_DEPAINT 3
|
||||
#define ME_ONELEFT 4
|
||||
#define ME_ONERIGHT 5
|
||||
#define ME_OPERATEICON 6 // (mx,my,0,0)
|
||||
#define ME_EXAMINEICON 7 // (mx,my,0,0)
|
||||
#define ME_SHOWICONNAME 8 // (mx,my,0,0)
|
||||
#define ME_INVRESET 9
|
||||
|
||||
/*************************************************************************
|
||||
* STRINGHE *
|
||||
*************************************************************************/
|
||||
/* String names */
|
||||
#define MC_STRING 4
|
||||
|
||||
#define ME_HOMOSPEAK 2 // (...)
|
||||
#define ME_HOMOSPEAKING 3 // (someone,)
|
||||
#define ME_SOMEONESPEAKING 5 // (...)
|
||||
#define ME_SOMEONEWAIT2SPEAK 7
|
||||
#define ME_SOMEONEWAIT2MUTE 8
|
||||
|
||||
/*************************************************************************
|
||||
* OPERAZIONI CON IL MOUSE *
|
||||
*************************************************************************/
|
||||
/* Notification of mouse action */
|
||||
#define MC_ACTION 5
|
||||
|
||||
#define ME_MOUSEOPERATE 0
|
||||
#define ME_MOUSEEXAMINE 1
|
||||
#define ME_INVOPERATE 2
|
||||
#define ME_INVEXAMINE 3
|
||||
#define ME_USEWITH 4
|
||||
|
||||
/*************************************************************************
|
||||
* DIALOGHI *
|
||||
*************************************************************************/
|
||||
/* Notification of dialog event */
|
||||
#define MC_DIALOG 6
|
||||
|
||||
#define ME_ENDSCELTA 0
|
||||
#define ME_STARTDIALOG 1
|
||||
/*
|
||||
#define ME_RESETARG 0
|
||||
#define ME_CLEARARG 1
|
||||
#define ME_SHOWARG 2
|
||||
#define ME_UPDATEARG 3
|
||||
#define ME_STARTNEWDLG 4
|
||||
#define ME_CLICKONARG 10
|
||||
#define ME_WAITBATTUTA 23
|
||||
#define ME_BATTUTA 20 //(battuta,...)
|
||||
#define ME_FINEBATTUTA 21
|
||||
#define ME_WAITFINEBATTUTA 22
|
||||
#define ME_STARTBATTUTA 24
|
||||
#define ME_BATTUTA2 25 //(battuta,...)
|
||||
*/
|
||||
/*************************************************************************
|
||||
* PORTE *
|
||||
*************************************************************************/
|
||||
/* Notification of dialog event */
|
||||
#define ME_INITOPENDOOR 0
|
||||
#define ME_OPENDOOR 1
|
||||
#define ME_WAITOPENDOOR 2
|
||||
|
||||
/*************************************************************************
|
||||
* DOING *
|
||||
*************************************************************************/
|
||||
/* Notification of doing event */
|
||||
#define MC_DOING 8
|
||||
|
||||
#define ME_INITOPENCLOSE 0
|
||||
#define ME_OPENCLOSE 1
|
||||
#define ME_WAITOPENCLOSE 2
|
||||
|
||||
/*************************************************************************
|
||||
* SCRIPT *
|
||||
*************************************************************************/
|
||||
#define C_RANIM 0 // Room
|
||||
|
||||
#define C_ONAME 0 // Object
|
||||
#define C_OEXAMINE 1 // Object
|
||||
#define C_OACTION 2 // Object
|
||||
#define C_OGOROOM 3 // Object
|
||||
#define C_OMODE 4 // Object
|
||||
#define C_OFLAG 5 // Object
|
||||
|
||||
#define C_INAME 0 // InvObject
|
||||
#define C_IEXAMINE 1 // InvObject
|
||||
#define C_IACTION 2 // InvObject
|
||||
#define C_IFLAG 3 // InvObject
|
||||
|
||||
#define C_AFLAG 0 // Anim
|
||||
#define C_ADELAY 1 // Anim
|
||||
|
||||
#define C_WAITASTART 1
|
||||
#define C_WAITAEND 0
|
||||
|
||||
#define C_DDEFANI 0 // Dialog
|
||||
#define C_DLINKANI 1
|
||||
#define C_DSPEAKANI 2
|
||||
#define C_DLISTENANI 3
|
||||
#define C_DSCELTADISATTIVATO 4
|
||||
|
||||
#define C_DADEFANI 0 // Dialog Alternativo
|
||||
#define C_DALINKANI 1
|
||||
#define C_DASPEAKANI 2
|
||||
#define C_DALISTENANI 3
|
||||
|
||||
#define C_SEMDIAG 0 // Semafori
|
||||
|
||||
#define MC_SCRIPT 9
|
||||
// (b,w1,w2,l)
|
||||
#define ME_PAUSE 0 // (0,time,0,0)
|
||||
#define ME_SETROOM 1 // (campo,indice,[bit/indice2c],valore)
|
||||
#define ME_SETOBJ 2 // (campo,indice,[bit/indice2c],valore)
|
||||
#define ME_SETINVOBJ 3 // (campo,indice,[bit/indice2c],valore)
|
||||
#define ME_SETANIM 4 // (campo,indice,[bit/indice2c],valore)
|
||||
#define ME_ADDICON 5 // (0,icona,0,0)
|
||||
#define ME_PLAYDIALOG 6 // (0,dialogo,0,0)
|
||||
#define ME_SOMEONETALK 7 // (0,obj,anim,sentence)
|
||||
#define ME_SETSEM 8 // (0,indice,valore,0)
|
||||
#define ME_SETBOX 9 // (on/off,room,box,0)
|
||||
#define ME_SETADIALOG 10 // (campo, 0, 0, valore)
|
||||
#define ME_TORNAORBO 11
|
||||
#define ME_SETDIALOG 12 // (campo, indice, 0, valore)
|
||||
#define ME_SETANIMAZIONESPENTA 13 // (0, 0, 0, valore)
|
||||
#define ME_PLAYSOUND 14 // (0,indice,0,0)
|
||||
#define ME_STOPSOUND 15 // (0,indice,0,0)
|
||||
#define ME_HOMOSAY 16 // (0,0,0,sentence)
|
||||
#define ME_REGENROOM 17
|
||||
#define ME_CHANGER 18 // (0,room,door,0)
|
||||
#define ME_KILLICON 19 // (0,icona,0,0)
|
||||
|
||||
/*************************************************************************
|
||||
* ANIMAZIONI *
|
||||
*************************************************************************/
|
||||
/* Notification of mouse action */
|
||||
#define MC_ANIMATION 64
|
||||
|
||||
#define ME_SHOWANIM 0
|
||||
#define ME_ADDANIM 1
|
||||
#define ME_DELANIM 2
|
||||
|
||||
/*************************************************************************
|
||||
* HOMO *
|
||||
*************************************************************************/
|
||||
/* Notification of dialog event */
|
||||
#define MC_HOMO 128
|
||||
|
||||
#define ME_HOMOSHOW 0
|
||||
#define ME_HOMORESETMOVE 1
|
||||
#define ME_HOMOGOTO 2
|
||||
#define ME_HOMOGOTOACTION 3
|
||||
#define ME_HOMOGOTOEXAMINE 4
|
||||
|
||||
#define ME_HOMOSTOP 5
|
||||
#define ME_HOMOTAKE 6
|
||||
#define ME_HOMOOPEN 7
|
||||
#define ME_HOMOCLEARQUEUE 8
|
||||
|
||||
#define ME_HOMOACTION 9
|
||||
#define ME_HOMOCONTINUEACTION 10
|
||||
#define ME_HOMOGOTOEXIT 11
|
||||
#define ME_HOMODOACTION 12
|
132
engines/trecision/nl/process.cpp
Normal file
132
engines/trecision/nl/process.cpp
Normal file
@ -0,0 +1,132 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "trecision/nl/lib/addtype.h"
|
||||
#include "trecision/nl/3d/3dinc.h"
|
||||
#include "trecision/nl/sysdef.h"
|
||||
#include "trecision/nl/struct.h"
|
||||
#include "trecision/nl/define.h"
|
||||
#include "trecision/nl/message.h"
|
||||
#include "trecision/nl/extern.h"
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
uint32 NextRefresh = 0;
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* PROCESSTIME */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void ProcessTime() {
|
||||
#define SCR 2
|
||||
void RefreshAllAnimations();
|
||||
|
||||
extern int16 TextStackTop;
|
||||
|
||||
static uint8 OldRegInvSI = 0xFF;
|
||||
static uint8 OldRegInvSL = 0xFF;
|
||||
static uint8 OldLightIcon = 0xFF;
|
||||
|
||||
TheTime = ReadTime();
|
||||
RefreshAllAnimations();
|
||||
|
||||
if (TheTime >= NextRefresh) {
|
||||
PaintString();
|
||||
|
||||
if ((_inventoryStatus == INV_PAINT) || (_inventoryStatus == INV_DEPAINT))
|
||||
RollInventory(_inventoryStatus);
|
||||
|
||||
if ((_inventoryStatus != INV_OFF) && ((OldRegInvSI != RegenInvStartIcon) ||
|
||||
(OldRegInvSL != RegenInvStartLine) || (OldLightIcon != LightIcon) ||
|
||||
(SemForceRegenInventory))) {
|
||||
RegenInventory(RegenInvStartIcon, RegenInvStartLine);
|
||||
OldRegInvSI = RegenInvStartIcon;
|
||||
OldRegInvSL = RegenInvStartLine;
|
||||
OldLightIcon = LightIcon;
|
||||
SemForceRegenInventory = false;
|
||||
}
|
||||
|
||||
PaintScreen(0);
|
||||
TextStackTop = -1;
|
||||
|
||||
SemScreenRefreshed = true;
|
||||
uint32 PaintTime = ReadTime();
|
||||
if ((PaintTime - TheTime) >= 5)
|
||||
NextRefresh = PaintTime + 1;
|
||||
else
|
||||
NextRefresh = TheTime + 5;
|
||||
SemMousePolling = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* PROCESSMOUSE */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void ProcessMouse() {
|
||||
static LLBOOL MaskMouse;
|
||||
static uint16 oldmx, oldmy;
|
||||
static LLBOOL LastMouseON = true;
|
||||
uint16 tmpmx;
|
||||
|
||||
if ((LastMouseON == true) && (SemMouseEnabled == false)) {
|
||||
oldmx = 0; // SPEGNI
|
||||
oldmy = 0;
|
||||
Mouse(2);
|
||||
} else if ((LastMouseON == false) && (SemMouseEnabled == true)) {
|
||||
oldmx = 0; // ACCENDI
|
||||
oldmy = 0;
|
||||
Mouse(1);
|
||||
}
|
||||
|
||||
LastMouseON = SemMouseEnabled;
|
||||
|
||||
Mouse(3);
|
||||
|
||||
if (/*(!Semscriptactive) && */(!SemMouseEnabled))
|
||||
return;
|
||||
|
||||
if ((my >= VideoCent.y0) && (my <= VideoCent.y1))
|
||||
tmpmx = mx;
|
||||
else
|
||||
tmpmx = mx;
|
||||
|
||||
if ((mright || mleft)) {
|
||||
if (!MaskMouse) {
|
||||
if (mright)
|
||||
doEvent(MC_MOUSE, ME_MRIGHT, MP_DEFAULT, (uint16)tmpmx, (uint16)my, 0, 0);
|
||||
else
|
||||
doEvent(MC_MOUSE, ME_MLEFT, MP_DEFAULT, (uint16)tmpmx, (uint16)my, 0, 0);
|
||||
MaskMouse = true;
|
||||
}
|
||||
} else
|
||||
MaskMouse = false;
|
||||
|
||||
if (!(mright || mleft))
|
||||
if (!Semscriptactive)
|
||||
if ((tmpmx != oldmx) || (my != oldmy)) {
|
||||
doEvent(MC_MOUSE, ME_MMOVE, MP_DEFAULT, (uint16)tmpmx, (uint16)my, 0, 0);
|
||||
oldmx = tmpmx;
|
||||
oldmy = my;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
352
engines/trecision/nl/proto.h
Normal file
352
engines/trecision/nl/proto.h
Normal file
@ -0,0 +1,352 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
void warning(const char *format, ...);
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
struct STexture;
|
||||
int ACompare(const void *p1, const void *p2);
|
||||
char AnimFileInit(const char *fname);
|
||||
void AnimFileFinish();
|
||||
int AnimFileOpen(const char *name);
|
||||
int FmvFileOpen(const char *name);
|
||||
char SpeechFileInit(const char *fname);
|
||||
void SpeechFileFinish();
|
||||
int SpeechFileLen(const char *name);
|
||||
int SpeechFileRead(const char *name, uint8 *buf);
|
||||
void BCopy(uint32 Sco, uint8 *Src, uint32 Len);
|
||||
void DCopy(uint32 Sco, uint8 *Src, uint32 Len);
|
||||
void StartSmackAnim(uint16 num);
|
||||
void StopSmackAnim(uint16 num);
|
||||
void StopAllSmackAnims();
|
||||
void StartFullMotion(const char *name);
|
||||
void StopFullMotion();
|
||||
void RegenAnim(int box);
|
||||
void RedrawRoom();
|
||||
void doIntroText(int frame);
|
||||
void decompress(const uint8 *src, unsigned int src_len, uint8 *dst, unsigned int dst_len);
|
||||
uint32 DecXPK(const char *ArcName, const char *FileName, uint8 *DestArea, uint8 *DecArea);
|
||||
uint32 DecCR(const char *FileName, uint8 *DestArea, uint8 *DecArea);
|
||||
uint16 vr(int16 x, int16 y);
|
||||
void VPix(int16 x, int16 y, uint16 col);
|
||||
void VMouseOFF();
|
||||
void VMouseON();
|
||||
void VMouseRestore();
|
||||
void VMouseCopy();
|
||||
uint16 TextLength(const char *sign, uint16 num);
|
||||
uint16 CheckDText(struct SDText);
|
||||
void DText(struct SDText);
|
||||
void IntroText(int16 x, int16 y, const char *sign, uint8 *buf);
|
||||
void IconSnapShot();
|
||||
int16 DataSave();
|
||||
int16 DataLoad();
|
||||
int16 QuitGame();
|
||||
void DemoOver();
|
||||
void CheckFileInCD(const char *name);
|
||||
void openSys();
|
||||
void OpenVideo();
|
||||
uint32 ReadActor(const char *filename, uint8 *Area);
|
||||
int actionInRoom(int curA);
|
||||
void ReadAction(const char *name);
|
||||
void ReadLoc();
|
||||
void TendIn();
|
||||
void ReadObj();
|
||||
void ReadExtraObj2C();
|
||||
void ReadExtraObj41D();
|
||||
void ReadSounds();
|
||||
void RegenRoom();
|
||||
void PaintRegenRoom();
|
||||
void DrawObj(struct SDObj);
|
||||
void RegenInventory(uint8 StartIcon, uint8 StartLine);
|
||||
void RGBColor(uint16 a, uint8 *r, uint8 *g, uint8 *b);
|
||||
uint16 RGB2Color(uint8 r, uint8 g, uint8 b);
|
||||
uint16 ULaw2Linear(uint8 ulawbyte);
|
||||
void GrabVideo();
|
||||
void SaveAction();
|
||||
void SetHeadTexture(uint8 num);
|
||||
void SetTexture(int flag);
|
||||
void ResetZB(int x1, int y1, int x2, int y2);
|
||||
void VCopy(uint32 Sco, uint16 *Src, uint32 Len);
|
||||
void MCopy(uint16 *Dest, uint16 *Src, uint32 Len);
|
||||
void ShowScreen(int px, int py, int dx, int dy);
|
||||
void UpdatePixelFormat(uint16 *p, uint32 len);
|
||||
uint16 UnUpdatePixelFormat(uint16 t);
|
||||
uint32 TrecRnd(uint32 t);
|
||||
int16 CheckMask(uint16 MX, uint16 my);
|
||||
uint8 CheckMaskBox(uint16 mx, uint16 my);
|
||||
//void __interrupt __far pkbd_int();
|
||||
void setbiosisr();
|
||||
void setrawisr();
|
||||
void installlowisr();
|
||||
char ReadKey();
|
||||
char *GetNextSent();
|
||||
void SaveAll();
|
||||
void LoadAll();
|
||||
void actorDoAction(int whatAction);
|
||||
void actorStop();
|
||||
int actorDoNextFrame();
|
||||
void setPosition(int num);
|
||||
void goToPosition(int num);
|
||||
void lookAt(float x, float z);
|
||||
float sinCosAngle(float sinus, float cosinus);
|
||||
void createTextureMapping(int16 mat);
|
||||
uint16 shadow(uint32 val, uint8 num);
|
||||
uint16 aliasing(uint32 val1, uint32 val2, uint8 num);
|
||||
void textureTriangle(int32 x1, int32 y1, int32 z1, int32 c1, int32 tx1, int32 ty1, int32 x2, int32 y2, int32 z2, int32 c2, int32 tx2, int32 ty2, int32 x3, int32 y3, int32 z3, int32 c3, int32 tx3, int32 ty3, struct STexture *t);
|
||||
void textureScanEdge(int32 x1, int32 y1, int32 z1, int32 c1, int32 tx1, int32 ty1, int32 x2, int32 y2, int32 z2, int32 c2, int32 tx2, int32 ty2);
|
||||
void shadowTriangle(int32 x1, int32 y1, int32 x2, int32 y2, int32 x3, int32 y3, uint8 cv, int32 zv);
|
||||
void shadowScanEdge(int32 x1, int32 y1, int32 x2, int32 y2);
|
||||
void gouraudTriangle(int32 x1, int32 y1, int32 z1, int32 c1, int32 x2, int32 y2, int32 z2, int32 c2, int32 x3, int32 y3, int32 z3, int32 c3, uint32 *mat);
|
||||
void gouraudScanEdge(int32 x1, int32 y1, int32 z1, int32 c1, int32 x2, int32 y2, int32 z2, int32 c2);
|
||||
void init3DRoom(int16 dx, uint16 *destBuffer, int16 *zBuffer);
|
||||
void setClipping(int16 x1, int16 y1, int16 x2, int16 y2);
|
||||
void setZBufferRegion(int16 sx, int16 sy, int16 dx);
|
||||
signed char clockWise(int16 x1, int16 y1, int16 x2, int16 y2, int16 x3, int16 y3);
|
||||
void drawCharacter(uint8 flag);
|
||||
int read3D(const char *c);
|
||||
void findPath();
|
||||
void findShortPath();
|
||||
float evalPath(int a, float destX, float destZ, int nearP);
|
||||
void buildFramelist();
|
||||
int nextStep();
|
||||
void displayPath();
|
||||
int findAttachedPanel(int srcP, int destP);
|
||||
int pointInside(int pan, double x, double z);
|
||||
int pathCompare(const void *arg1, const void *arg2);
|
||||
void sortPath();
|
||||
float distF(float x1, float y1, float x2, float y2);
|
||||
float dist3D(float x1, float y1, float z1, float x2, float y2, float z2);
|
||||
void putPix(int x, int y, uint16 c);
|
||||
void cross3D(float x, float y, float z, uint16 c);
|
||||
void whereIs(int px, int py);
|
||||
void pointOut();
|
||||
void putLine(int x0, int y0, int x1, int y1, uint16 c);
|
||||
void viewPanel(struct SPan *p);
|
||||
void pointProject(float x, float y, float z);
|
||||
void invPointProject(int x, int y);
|
||||
int intersectLinePanel(struct SPan *p, float x, float y, float z);
|
||||
int intersectLineFloor(float x, float y, float z);
|
||||
int intersectLineLine(float xa, float ya, float xb, float yb, float xc, float yc, float xd, float yd);
|
||||
void initSortPan();
|
||||
int panCompare(const void *arg1, const void *arg2);
|
||||
void sortPanel();
|
||||
void actorOrder();
|
||||
void doAction();
|
||||
void doMouse();
|
||||
void doInventory();
|
||||
void StartCharacterAction(uint16 Act, uint16 NewRoom, uint8 NewPos, uint16 sent);
|
||||
void doHomo();
|
||||
void doSystem();
|
||||
void doScrollInventory(uint16 mousex);
|
||||
void RollInventory(uint8 status);
|
||||
void ChangeCustomCommand();
|
||||
void doIdle();
|
||||
void DialogPrint(int x, int y, int c, const char *txt);
|
||||
void MostraScelte(uint16 i);
|
||||
void UpdateScelte(int16 dmx, int16 dmy);
|
||||
void ScegliScelta(int16 dmx, int16 dmy);
|
||||
void PlayDialog(uint16 i);
|
||||
void afterChoice(int numframe);
|
||||
void DialogHandler(int numframe);
|
||||
void PlayScelta(uint16 i);
|
||||
void doDialog();
|
||||
void doRoomIn(uint16 TheObj);
|
||||
void doRoomOut(uint16 TheObj);
|
||||
void doMouseExamine(uint16 TheObj);
|
||||
void doMouseOperate(uint16 TheObj);
|
||||
void doMouseTake(uint16 TheObj);
|
||||
void doMouseTalk(uint16 TheObj);
|
||||
void doUseWith();
|
||||
void doInvInvUseWith();
|
||||
void doInvScrUseWith();
|
||||
void doScrScrUseWith();
|
||||
void doInvExamine();
|
||||
void doInvOperate();
|
||||
void doDoing();
|
||||
void doScript();
|
||||
void DialogExit();
|
||||
void ObjOpen(uint16 TheObj);
|
||||
void AtAnimFrm(uint16 TheAnim, uint8 TheFrm, int16 Rev);
|
||||
void AtHomoFrm();
|
||||
int16 AtMouseClick(uint16 TheObj);
|
||||
void AtEndChangeRoom();
|
||||
void ExecuteATFDO(struct ATFHandle *h, int doit, int32 obj);
|
||||
void ProcessATF(struct ATFHandle *h, int type, int atf);
|
||||
void InitAtFrameHandler(uint16 an, uint16 obj);
|
||||
void AtFrameNext();
|
||||
void AtFrameEnd(int type);
|
||||
void AtFrameHandler(int type);
|
||||
void initMain();
|
||||
void NextMessage();
|
||||
void BuildFileRef();
|
||||
void initScript();
|
||||
void ProcessTime();
|
||||
void ProcessMouse();
|
||||
void PaintScreen(uint8 flag);
|
||||
void AddLine(int16 x1, int16 x2, int16 y);
|
||||
int BlockCompare(const void *arg1, const void *arg2);
|
||||
void SortBlock();
|
||||
void PaintObjAnm(uint16 CurBox);
|
||||
int IntersecateRect(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4);
|
||||
int16 GetMessage(struct queue *lq);
|
||||
void InitMessageSystem();
|
||||
void InitQueue(struct queue *lq);
|
||||
void SuperEvent(uint8 cls, uint8 event, uint8 priority, uint16 wparam1, uint16 wparam2, uint8 bparam, uint32 lparam);
|
||||
void doEvent(uint8 cls, uint8 event, uint8 priority, uint16 wparam1, uint16 wparam2, uint8 bparam, uint32 lparam);
|
||||
void Scheduler();
|
||||
void ProcessTheMessage();
|
||||
void WaitUntilTheMessage(struct tagMessage *m);
|
||||
void OrderEvent(struct queue *lq);
|
||||
int16 TestEmptyQueue(struct queue *lq, uint8 cls);
|
||||
int16 TestEmptyHomoQueue4Script(struct queue *lq);
|
||||
void SwapMessage(struct tagMessage *m1, struct tagMessage *m2);
|
||||
void RepaintString();
|
||||
void PositionString(uint16 x, uint16 y, const char *string, uint16 *posx, uint16 *posy, int16 Homo);
|
||||
void ShowObjName(uint16 obj, int16 showhide);
|
||||
void ShowInvName(uint16 obj, int16 showhide);
|
||||
void FormattingSuperString();
|
||||
void FormattingOneString();
|
||||
void CharacterSay(uint16 i);
|
||||
void CharacterTalk(const char *s, int16 FromCharacterSay);
|
||||
void CharacterTalkInAction(uint16 ss);
|
||||
void CharacterContinueTalk();
|
||||
void CharacterMute();
|
||||
void SomeOneTalk(uint16 s, uint16 Person, uint16 NewAnim, int16 FromSomeOneSay);
|
||||
void SomeOneContinueTalk();
|
||||
void SomeOneMute();
|
||||
void doString();
|
||||
void initNames();
|
||||
void OneLeftInventory();
|
||||
void OneRightInventory();
|
||||
uint8 WhatIcon(uint16 mx);
|
||||
uint8 IconPos(uint8 icon);
|
||||
void KillIcon(uint8 icon);
|
||||
void AddIcon(uint8 icon);
|
||||
void ReplaceIcon(uint8 oldicon, uint8 newicon);
|
||||
void RegenInv(uint8 StartIcon, uint8 StartLine);
|
||||
void EndScript();
|
||||
void PlayScript(uint16 i);
|
||||
void EvalScript();
|
||||
void Text(uint16 x, uint16 y, const char *sign, uint16 tcol, uint16 scol);
|
||||
void ClearText();
|
||||
void PaintString();
|
||||
void DoText(uint16 x, uint16 y, const char *sign, uint16 tcol, uint16 scol);
|
||||
void DoClearText();
|
||||
void DoSys(uint16 TheObj);
|
||||
void SetRoom(uint16 r, bool b);
|
||||
//uint16 GetTokenValue(struct _no_name_ *where,const char *what);
|
||||
void outlog(const char *st, ...);
|
||||
//uint16 GetTokenValueDefault(struct _no_name_ *where,const char *what);
|
||||
void FreeDefineTable();
|
||||
int BuildDefineTable(const char *name);
|
||||
int InitStructures(const char **filelist);
|
||||
int ReadSentence();
|
||||
int ReadSysSent();
|
||||
int ReadScelta();
|
||||
int ReadBattuta();
|
||||
int ReadObjName();
|
||||
int ReadNBox();
|
||||
int ReadIndex();
|
||||
int ReadFlag();
|
||||
void AssignSound(int val);
|
||||
int ParseObject(const char *s);
|
||||
int ParseRoom(const char *s);
|
||||
int ParseAnim(const char *s);
|
||||
int ParseInv(const char *s);
|
||||
int ParseSound(const char *s);
|
||||
int ParseScelta();
|
||||
int ParseDialog(const char *s);
|
||||
int SaveTextTable(const char *name);
|
||||
void IfParseErrorDo(void *func);
|
||||
int ParseError(const char *ln, ...);
|
||||
int JParse_ReadByte();
|
||||
int JParse_PrevByte();
|
||||
int OpenNL(const char *name);
|
||||
void CloseNL();
|
||||
int SearchArgument(const char *t, ...);
|
||||
int SearchArgumentEOL(const char *t, ...);
|
||||
int ReadString(const char *str);
|
||||
int ReadArgument_(const char *str, int teol);
|
||||
int ReadNumber();
|
||||
float ReadFloat();
|
||||
void ReadVector(float *v);
|
||||
int MatchWord(const char *token);
|
||||
int MatchToEOL(int s);
|
||||
void main(int argc, char *argv[]);
|
||||
void CheckSystem();
|
||||
void LockVideo();
|
||||
void UnlockVideo();
|
||||
char GetKey();
|
||||
char waitKey();
|
||||
void FreeKey();
|
||||
uint32 MemoryAvailable();
|
||||
void DetectVesaMode(unsigned int ModeNumber);
|
||||
void SetVesaMode(unsigned int ModeNumber);
|
||||
void SetVesaLineLength(unsigned int Length);
|
||||
void SetVesaStartVisualPage(unsigned int StartX, unsigned int StartY);
|
||||
void SetVesaPage(unsigned int PageNumber);
|
||||
void ClearScreen();
|
||||
uint32 ReadTime();
|
||||
void NlDelay(uint32 val);
|
||||
void NlDissolve(int val);
|
||||
void WaitCop(uint8 num);
|
||||
//void __loadds __far click_handler(int max,int mbx,int mcx,int mdx);
|
||||
void Mouse(uint8 opt);
|
||||
void CloseSys(const char *str);
|
||||
void CallSmackOpen(const char *name, int f1, int f2);
|
||||
void CallSmackClose();
|
||||
void CallSmackNextFrame();
|
||||
void CallSmackVolumePan(int buf, int track, int vol);
|
||||
void CallSmackGoto(int buf, int num);
|
||||
void CallSmackSoundOnOff(int pos, int on);
|
||||
void RefreshAllAnimations();
|
||||
void RegenSmackAnim(int num);
|
||||
void RegenSmackIcon(int StartIcon, int num);
|
||||
void PlayFullMotion(int start, int end);
|
||||
void BattutaPrint(int x, int y, int c, const char *txt);
|
||||
void PaintSmackBuffer(int px, int py, int dx, int dy);
|
||||
void RegenFullMotion();
|
||||
void *smkmalloc(unsigned int size);
|
||||
void smkfree(void *ptr);
|
||||
void finiObjects();
|
||||
int32 __stdcall WindowProc(void *hWnd, unsigned int message, unsigned int wParam, int32 lParam);
|
||||
//void click_handler(int max,int mbx,int mcx,int mdx);
|
||||
void CallSmackVolumePan(int buf, int track, int vol);
|
||||
uint16 PalTo16bit(uint8 r, uint8 g, uint8 b);
|
||||
void soundtimefunct();
|
||||
void StartSoundSystem();
|
||||
void StopSoundSystem();
|
||||
int16 LoadAudioWav(int num, uint8 *wav, int len);
|
||||
void NLPlaySound(int num);
|
||||
void NLStopSound(int num);
|
||||
void SoundFadOut();
|
||||
void SoundFadIn(int num);
|
||||
void WaitSoundFadEnd();
|
||||
void SoundPasso(int midx, int midz, int act, int frame, uint16 *list);
|
||||
void SetBackgroundVolume(int val);
|
||||
void serve_sample();
|
||||
void ContinueTalk();
|
||||
int32 Talk(const char *name);
|
||||
void StopTalk();
|
||||
|
||||
} // End of namespace Trecision
|
522
engines/trecision/nl/regen.cpp
Normal file
522
engines/trecision/nl/regen.cpp
Normal file
@ -0,0 +1,522 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <conio.h>
|
||||
#include <stdlib.h>
|
||||
#include "trecision/nl/lib/addtype.h"
|
||||
#include "trecision/nl/3d/3dinc.h"
|
||||
#include "trecision/nl/sysdef.h"
|
||||
#include "trecision/nl/struct.h"
|
||||
#include "trecision/nl/define.h"
|
||||
#include "trecision/nl/ll/llinc.h"
|
||||
#include "trecision/nl/extern.h"
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
uint16 CurSortTableIndex = 0;
|
||||
int16 limiti[50][4];
|
||||
uint16 limitinum;
|
||||
|
||||
#define MAXBLOCK 5000
|
||||
uint32 PaintBlock[MAXBLOCK];
|
||||
int16 BlockCount;
|
||||
|
||||
int xr1, xr2, yr1, yr2;
|
||||
int Hlim, Tlim;
|
||||
int VisualRef[50];
|
||||
|
||||
struct SDObj DObj;
|
||||
int sflag;
|
||||
extern uint16 _animMaxX, _animMinX, _animMaxY, _animMinY;
|
||||
int fillviola = 0;
|
||||
|
||||
uint32 DislVar = 0;
|
||||
|
||||
void PaintScreen(uint8 flag) {
|
||||
extern FILE *fhi;
|
||||
int a, liv;
|
||||
static int framenum;
|
||||
|
||||
AtFrameNext();
|
||||
|
||||
ContinueTalk();
|
||||
|
||||
sflag = flag;
|
||||
|
||||
PaintRegenRoom();
|
||||
|
||||
// if( ( !SemPaintHomo) && ( CurSortTableNum == 0 ) && ( TheString.sign == NULL ) && ( OldString.sign == NULL ) )
|
||||
// return;
|
||||
|
||||
Hlim = 255;
|
||||
Tlim = 255;
|
||||
for (a = 0; a < 20; a++)
|
||||
VisualRef[ a ] = 255;
|
||||
|
||||
limitinum = 0;
|
||||
SemPaintHomo = 1; // ridisegna sempre l'omino
|
||||
AddLine(0, 0, 0);
|
||||
|
||||
// CANCELLA L'OMINO
|
||||
if (SemShowHomo) { // se c'era una scritta
|
||||
// cancello omino
|
||||
DObj.x = 0;
|
||||
DObj.y = TOP;
|
||||
DObj.dx = CurRoomMaxX;
|
||||
DObj.dy = AREA;
|
||||
DObj.l[0] = _actor._lim[0];
|
||||
DObj.l[1] = _actor._lim[2] - TOP;
|
||||
DObj.l[2] = _actor._lim[1];
|
||||
DObj.l[3] = _actor._lim[3] - TOP;
|
||||
DObj.buf = ImagePointer;
|
||||
DObj.flag = COPYTORAM;
|
||||
DrawObj(DObj);
|
||||
|
||||
limiti[limitinum][0] = DObj.l[0]; // aggiunge rettangolo omino
|
||||
limiti[limitinum][1] = DObj.l[1] + TOP;
|
||||
limiti[limitinum][2] = DObj.l[2];
|
||||
limiti[limitinum][3] = DObj.l[3] + TOP;
|
||||
|
||||
Hlim = limitinum;
|
||||
limitinum ++;
|
||||
} else if (_animMinX != MAXX) {
|
||||
DObj.x = 0;
|
||||
DObj.y = TOP;
|
||||
DObj.dx = CurRoomMaxX;
|
||||
DObj.dy = AREA;
|
||||
DObj.l[0] = _animMinX;
|
||||
DObj.l[1] = _animMinY;
|
||||
DObj.l[2] = _animMaxX;
|
||||
DObj.l[3] = _animMaxY;
|
||||
DObj.buf = ImagePointer;
|
||||
DObj.flag = COPYTORAM;
|
||||
DrawObj(DObj);
|
||||
|
||||
limiti[limitinum][0] = DObj.l[0]; // aggiunge rettangolo omino
|
||||
limiti[limitinum][1] = DObj.l[1] + TOP;
|
||||
limiti[limitinum][2] = DObj.l[2];
|
||||
limiti[limitinum][3] = DObj.l[3] + TOP;
|
||||
|
||||
Hlim = limitinum;
|
||||
limitinum ++;
|
||||
}
|
||||
|
||||
// CANCELLO LA SCRITTA
|
||||
if (TextStatus & TEXT_DEL) {
|
||||
// cancello scritta
|
||||
DObj.x = 0;
|
||||
DObj.y = TOP;
|
||||
DObj.dx = CurRoomMaxX;
|
||||
DObj.dy = 480;
|
||||
DObj.l[0] = OldString.x;
|
||||
DObj.l[1] = OldString.y - TOP;
|
||||
DObj.l[2] = DObj.l[0] + OldString.dx;
|
||||
DObj.l[3] = DObj.l[1] + OldString.dy;
|
||||
|
||||
if ((OldString.y >= TOP) && ((OldString.y + OldString.dy) < (AREA + TOP))) {
|
||||
DObj.buf = ImagePointer;
|
||||
DObj.flag = COPYTORAM;
|
||||
DrawObj(DObj);
|
||||
} else {
|
||||
for (a = (DObj.l[1] + TOP); a < (DObj.l[3] + TOP); a++)
|
||||
wordset(Video2 + DObj.l[0] + a * CurRoomMaxX, 0x0000, (DObj.l[2] - DObj.l[0]));
|
||||
}
|
||||
OldString.sign = NULL;
|
||||
|
||||
limiti[limitinum][0] = DObj.l[0]; // aggiunge rettangolo scritta
|
||||
limiti[limitinum][1] = DObj.l[1] + TOP;
|
||||
limiti[limitinum][2] = DObj.l[2];
|
||||
limiti[limitinum][3] = DObj.l[3] + TOP;
|
||||
|
||||
Tlim = limitinum;
|
||||
limitinum ++;
|
||||
|
||||
if (!(TextStatus & TEXT_DRAW)) // se non c'e' nuova scritta
|
||||
TextStatus = TEXT_OFF; // non aggiorna piu' scritta
|
||||
}
|
||||
|
||||
// if( ( TextStatus & TEXT_DRAW ) && ( ( TheString.sign == NULL ) || ( TheString.sign[0] == '\0' ) ) )
|
||||
// TextStatus = TEXT_OFF;
|
||||
|
||||
// CANCELLA TUTTI GLI OGGETTI TOGLI
|
||||
for (a = 0; a < CurSortTableNum; a++) {
|
||||
if (SortTable[a].togli == true) {
|
||||
DObj.x = 0;
|
||||
DObj.y = TOP;
|
||||
DObj.dx = CurRoomMaxX;
|
||||
DObj.dy = 480;
|
||||
|
||||
if (SortTable[a].typology == TYPO_BMP) {
|
||||
DObj.l[0] = _obj[ SortTable[a].index ]._px;
|
||||
DObj.l[1] = _obj[ SortTable[a].index ]._py;
|
||||
DObj.l[2] = DObj.l[0] + _obj[ SortTable[a].index ]._dx;
|
||||
DObj.l[3] = DObj.l[1] + _obj[ SortTable[a].index ]._dy;
|
||||
}
|
||||
|
||||
DObj.buf = ImagePointer;
|
||||
DObj.flag = COPYTORAM;
|
||||
DrawObj(DObj);
|
||||
|
||||
limiti[limitinum][0] = DObj.l[0]; // aggiunge rettangolo
|
||||
limiti[limitinum][1] = DObj.l[1] + TOP;
|
||||
limiti[limitinum][2] = DObj.l[2];
|
||||
limiti[limitinum][3] = DObj.l[3] + TOP;
|
||||
|
||||
if ((SortTable[a + 1].typology == SortTable[a].typology) &&
|
||||
(SortTable[a + 1].roomindex == SortTable[a].roomindex))
|
||||
VisualRef[ a + 1 ] = limitinum;
|
||||
|
||||
limitinum ++;
|
||||
}
|
||||
}
|
||||
|
||||
// azzera variabili
|
||||
BlockCount = 0;
|
||||
// trova la posizione dell'omino
|
||||
actorOrder();
|
||||
// disegna gli oggetti che intersecano nel box di sfondo
|
||||
//PaintObjAnm( BACKGROUND );
|
||||
|
||||
// PER OGNI BOX DALL'ORIZZONTE IN AVANTI...
|
||||
// COPIA PER LIVELLO
|
||||
for (liv = _numSortPan; liv >= 0; liv--) {
|
||||
uint16 CurBox = _sortPan[liv]._num;
|
||||
|
||||
// disegna tutti gli oggetti e le animazioni che intersecano
|
||||
// i limiti e si riferiscono al box corrente
|
||||
PaintObjAnm(CurBox);
|
||||
|
||||
}
|
||||
|
||||
// disegna gli oggetti che intersecano nel foreground
|
||||
//PaintObjAnm( FOREGROUND );
|
||||
|
||||
if (TextStatus == TEXT_ON) {
|
||||
for (a = 0; a < limitinum; a++) {
|
||||
if (IntersecateRect(limiti[a][0], limiti[a][1],
|
||||
limiti[a][2], limiti[a][3],
|
||||
TheString.x, TheString.y,
|
||||
TheString.x + TheString.dx,
|
||||
TheString.y + TheString.dy)) {
|
||||
TheString.l[0] = xr1;
|
||||
TheString.l[1] = yr1;
|
||||
TheString.l[2] = xr2;
|
||||
TheString.l[3] = yr2;
|
||||
|
||||
DText(TheString);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (TextStatus & TEXT_DRAW) {
|
||||
DText(TheString);
|
||||
limiti[limitinum][0] = TheString.x; // aggiunge rettangolo
|
||||
limiti[limitinum][1] = TheString.y;
|
||||
limiti[limitinum][2] = TheString.x + TheString.dx;
|
||||
limiti[limitinum][3] = TheString.y + TheString.dy;
|
||||
|
||||
Tlim = limitinum;
|
||||
limitinum ++;
|
||||
|
||||
TextStatus = TEXT_DRAW; // attiva aggiornamento scritta
|
||||
}
|
||||
|
||||
SoundPasso((_actor._lim[1] + _actor._lim[0]) / 2, (_actor._lim[5] + _actor._lim[4]) / 2, _actor._curAction, _actor._curFrame, Room[_curRoom]._sounds);
|
||||
|
||||
for (liv = 0; liv < limitinum; liv++) {
|
||||
for (int b = limiti[liv][1]; b < limiti[liv][3]; b++) {
|
||||
AddLine(limiti[liv][0], limiti[liv][2], b);
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag && !SemDialogActive) {
|
||||
// sorta i blocchi da copiare ed elimina quelli inutili
|
||||
SortBlock();
|
||||
VMouseCopy();
|
||||
for (a = 0; a < BlockCount; a++) {
|
||||
// if ( fillviola )
|
||||
// wordset( Video2+(PaintBlock[a]&0xFFFFF), 0x0e0e, ((PaintBlock[a]&0xFFF00000)>>20)&0xFFF );
|
||||
|
||||
VCopy((PaintBlock[a] & 0xFFFFF), Video2 + (PaintBlock[a] & 0xFFFFF), ((PaintBlock[a] & 0xFFF00000) >> 20) & 0xFFF);
|
||||
}
|
||||
VMouseRestore();
|
||||
UnlockVideo();
|
||||
|
||||
// ShowScreen(0,0,640,480);
|
||||
}
|
||||
|
||||
framenum ++;
|
||||
|
||||
for (a = 0; a < CurSortTableNum; a++) {
|
||||
SortTable[a].index = 0;
|
||||
SortTable[a].roomindex = 0;
|
||||
SortTable[a].typology = 0;
|
||||
SortTable[a].framecur = 0;
|
||||
}
|
||||
|
||||
CurSortTableNum = 0;
|
||||
|
||||
SemPaintHomo = 0;
|
||||
SemWaitRegen = false;
|
||||
|
||||
// gestione papaverina ritardata
|
||||
if ((_curRoom == r4A) && (_obj[oCIOCCOLATINI4A]._flag & OBJFLAG_EXTRA)) {
|
||||
extern uint16 _curAnimFrame[];
|
||||
if (_curAnimFrame[0] > 480) {
|
||||
PlayScript(s4AHELLEN);
|
||||
_obj[oCIOCCOLATINI4A]._flag &= ~OBJFLAG_EXTRA;
|
||||
}
|
||||
return;
|
||||
}
|
||||
//
|
||||
}
|
||||
|
||||
/* -----------------12/06/97 21.35-------------------
|
||||
Aggiunge linea a buffer da copiare
|
||||
--------------------------------------------------*/
|
||||
void AddLine(int16 x1, int16 x2, int16 y) {
|
||||
if (x1 > x2) {
|
||||
int16 t = x1;
|
||||
x1 = x2;
|
||||
x2 = t;
|
||||
}
|
||||
|
||||
PaintBlock[BlockCount++] = (uint32)((uint32)(y * CurRoomMaxX + x1) & 0xFFFFF) + ((((uint32)(x2 - x1) & 0xFFF) << 20) & 0xFFF00000);
|
||||
|
||||
if (BlockCount >= MAXBLOCK) {
|
||||
warning(_sysSent[19]);
|
||||
CloseSys(_sysSent[19]);
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------============-------------------
|
||||
Compare panel distance (qsort)
|
||||
--------------------------------------------------*/
|
||||
int BlockCompare(const void *arg1, const void *arg2) {
|
||||
uint32 p1 = *(uint32 *)arg1;
|
||||
uint32 p2 = *(uint32 *)arg2;
|
||||
|
||||
if ((p1 & 0xFFFFF) > (p2 & 0xFFFFF))
|
||||
return 1;
|
||||
|
||||
if ((p1 & 0xFFFFF) < (p2 & 0xFFFFF))
|
||||
return -1;
|
||||
|
||||
if ((p1 & 0xFFF00000) > (p2 & 0xFFF00000))
|
||||
return -1;
|
||||
|
||||
if ((p1 & 0xFFF00000) < (p2 & 0xFFF00000))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------15/10/96 10.34-------------------
|
||||
Sorta i blocchi da visualizzare
|
||||
--------------------------------------------------*/
|
||||
void SortBlock() {
|
||||
// si possono verificare 4 casi
|
||||
// 1) x1 < a1 e a1 < x2 < a2 => a1 = x1
|
||||
// 2) a1 < x1 < a2 e x2 > a2 => a2 = x2
|
||||
// 3) a1 < x1 < x2 < a2 => break
|
||||
// 4) x1 < a1 e x2 > a2 => a1 = x1 e a2 = x2
|
||||
uint32 x1, x2, c;
|
||||
|
||||
qsort(&PaintBlock[0], BlockCount, sizeof(uint32), BlockCompare);
|
||||
|
||||
for (c = 0; c < BlockCount;) {
|
||||
uint32 a1 = (PaintBlock[c] & 0xFFFFF);
|
||||
uint32 a2 = a1 + (((PaintBlock[c] & 0xFFF00000) >> 20) & 0xFFF);
|
||||
uint32 oc = c;
|
||||
c ++;
|
||||
|
||||
// finche' il blocco seguente non e' completamente staccato dal blocco attuale
|
||||
while ((c < BlockCount) && ((x1 = (PaintBlock[c] & 0xFFFFF)) < a2)) {
|
||||
// se allarga il blocco precedente aggiorna
|
||||
if ((x2 = x1 + (((PaintBlock[c] & 0xFFF00000) >> 20) & 0xFFF)) > a2)
|
||||
a2 = x2;
|
||||
// altrimenti cancella il blocco
|
||||
else
|
||||
PaintBlock[c] = 0xFFFFFFFF;
|
||||
|
||||
c ++;
|
||||
}
|
||||
PaintBlock[oc] = (uint32)((((uint32)a1) & 0xFFFFF) + ((((uint32)(a2 - a1) & 0xFFF) << 20) & 0xFFF00000));
|
||||
}
|
||||
|
||||
qsort(&PaintBlock[0], BlockCount, sizeof(uint32), BlockCompare);
|
||||
|
||||
// leva i blocchi che non servono
|
||||
for (c = 0; c < BlockCount; c++)
|
||||
if (PaintBlock[c] == 0xFFFFFFFF)
|
||||
break;
|
||||
|
||||
BlockCount = c;
|
||||
}
|
||||
|
||||
/* -----------------12/06/97 21.35-------------------
|
||||
Disegna tutti gli oggetti e le animazioni che intersecano i limiti
|
||||
appartenenti a curbox
|
||||
--------------------------------------------------*/
|
||||
void PaintObjAnm(uint16 CurBox) {
|
||||
int a, b;
|
||||
uint16 TheObject;
|
||||
extern uint16 _playingAnims[];
|
||||
|
||||
RegenAnim(CurBox);
|
||||
|
||||
// disegna nuove schede appartenenti al box corrente
|
||||
for (a = 0; a < CurSortTableNum; a++) {
|
||||
if (!SortTable[a].togli) {
|
||||
if (SortTable[a].typology == TYPO_BMP) {
|
||||
if (_obj[SortTable[a].index]._nbox == CurBox) {
|
||||
// l'oggetto bitmap Š al livello desiderato
|
||||
DObj.x = _obj[ SortTable[a].index ]._px;
|
||||
DObj.y = _obj[ SortTable[a].index ]._py + TOP;
|
||||
DObj.dx = _obj[ SortTable[a].index ]._dx;
|
||||
DObj.dy = _obj[ SortTable[a].index ]._dy;
|
||||
DObj.l[0] = 0;
|
||||
DObj.l[1] = 0;
|
||||
DObj.l[2] = DObj.dx;
|
||||
DObj.l[3] = DObj.dy;
|
||||
DObj.buf = ObjPointers[ SortTable[a].roomindex ];
|
||||
DObj.mask = MaskPointers[ SortTable[a].roomindex ];
|
||||
DObj.flag = COPYTORAM;
|
||||
if (_obj[SortTable[a].index]._mode & OBJMODE_MASK)
|
||||
DObj.flag += DRAWMASK;
|
||||
DrawObj(DObj);
|
||||
|
||||
if (VisualRef[ a ] == 255) {
|
||||
limiti[limitinum][0] = DObj.x; // aggiunge rettangolo
|
||||
limiti[limitinum][1] = DObj.y;
|
||||
limiti[limitinum][2] = DObj.x + DObj.dx;
|
||||
limiti[limitinum][3] = DObj.y + DObj.dy;
|
||||
limitinum ++;
|
||||
} else {
|
||||
if (limiti[ VisualRef[a] ][0] > DObj.x)
|
||||
limiti[ VisualRef[a] ][0] = DObj.x;
|
||||
|
||||
if (limiti[ VisualRef[a] ][1] > DObj.y)
|
||||
limiti[ VisualRef[a] ][1] = DObj.y;
|
||||
|
||||
if (limiti[ VisualRef[a] ][2] < (DObj.x + DObj.dx))
|
||||
limiti[ VisualRef[a] ][2] = DObj.x + DObj.dx;
|
||||
|
||||
if (limiti[ VisualRef[a] ][3] < (DObj.y + DObj.dy))
|
||||
limiti[ VisualRef[a] ][3] = DObj.y + DObj.dy;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (a = 0; a < limitinum; a++) {
|
||||
for (b = 0; b < MAXOBJINROOM; b++) {
|
||||
TheObject = Room[_curRoom]._object[b];
|
||||
|
||||
if (!TheObject)
|
||||
break;
|
||||
|
||||
if ((_obj[TheObject]._mode & (OBJMODE_FULL | OBJMODE_MASK)) &&
|
||||
(_obj[TheObject]._mode & OBJMODE_OBJSTATUS) &&
|
||||
(_obj[TheObject]._nbox == CurBox)) {
|
||||
|
||||
if (IntersecateRect(limiti[a][0], limiti[a][1],
|
||||
limiti[a][2], limiti[a][3],
|
||||
_obj[TheObject]._px, _obj[TheObject]._py + TOP,
|
||||
_obj[TheObject]._px + _obj[TheObject]._dx,
|
||||
_obj[TheObject]._py + _obj[TheObject]._dy + TOP)) {
|
||||
DObj.x = _obj[ TheObject ]._px;
|
||||
DObj.y = _obj[ TheObject ]._py + TOP;
|
||||
DObj.dx = _obj[ TheObject ]._dx;
|
||||
DObj.dy = _obj[ TheObject ]._dy;
|
||||
DObj.l[0] = xr1;
|
||||
DObj.l[1] = yr1;
|
||||
DObj.l[2] = xr2;
|
||||
DObj.l[3] = yr2;
|
||||
|
||||
DObj.buf = ObjPointers[ b ];
|
||||
DObj.mask = MaskPointers[ b ];
|
||||
DObj.flag = COPYTORAM;
|
||||
|
||||
if (_obj[TheObject]._mode & OBJMODE_MASK)
|
||||
DObj.flag = COPYTORAM + DRAWMASK;
|
||||
|
||||
DrawObj(DObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((_actorPos == CurBox) &&
|
||||
((SemShowHomo) && (SemCharacterExist))) {
|
||||
drawCharacter(CALCPOINTS);
|
||||
|
||||
// allarga il rettangolo dell'omino
|
||||
if (limiti[Hlim][0] > _actor._lim[0])
|
||||
limiti[Hlim][0] = _actor._lim[0];
|
||||
|
||||
if (limiti[Hlim][1] > _actor._lim[2])
|
||||
limiti[Hlim][1] = _actor._lim[2];
|
||||
|
||||
if (limiti[Hlim][2] < _actor._lim[1])
|
||||
limiti[Hlim][2] = _actor._lim[1];
|
||||
|
||||
if (limiti[Hlim][3] < _actor._lim[3])
|
||||
limiti[Hlim][3] = _actor._lim[3];
|
||||
|
||||
ResetZB(_actor._lim[0], _actor._lim[2], _actor._lim[1], _actor._lim[3]);
|
||||
drawCharacter(DRAWFACES);
|
||||
|
||||
//SemPaintHomo = 0;
|
||||
} else if ((_actorPos == CurBox) && !(SemDialogActive)) {
|
||||
RegenSmackAnim(_playingAnims[1]);
|
||||
}
|
||||
}
|
||||
|
||||
int IntersecateRect(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) {
|
||||
if ((x1 <= x4) && (x2 >= x3) && (y1 <= y4) && (y2 >= y3)) {
|
||||
if (x3 > x1)
|
||||
xr1 = 0; // 0
|
||||
else
|
||||
xr1 = x1 - x3;
|
||||
|
||||
if (x2 < x4)
|
||||
xr2 = x2 - x3;
|
||||
else
|
||||
xr2 = x4 - x3; // _dx
|
||||
|
||||
if (y3 > y1)
|
||||
yr1 = 0; // 0
|
||||
else
|
||||
yr1 = y1 - y3;
|
||||
|
||||
if (y2 < y4)
|
||||
yr2 = y2 - y3;
|
||||
else
|
||||
yr2 = y4 - y3; // _dy
|
||||
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
268
engines/trecision/nl/schedule.cpp
Normal file
268
engines/trecision/nl/schedule.cpp
Normal file
@ -0,0 +1,268 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <conio.h>
|
||||
#include <string.h>
|
||||
#include "trecision/nl/lib/addtype.h"
|
||||
#include "trecision/nl/sysdef.h"
|
||||
#include "trecision/nl/struct.h"
|
||||
#include "trecision/nl/message.h"
|
||||
#include "trecision/nl/extern.h"
|
||||
#include "trecision/nl/define.h"
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
int maxmesg, maxmesh, maxmesa;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* GETMESSAGE */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
LLBOOL GetMessage(pqueue *lq) {
|
||||
if (!(lq->len)) return true;
|
||||
|
||||
TheMessage = lq->event[lq->head++];
|
||||
if (lq->head == MAXMESSAGE) lq->head = 0;
|
||||
lq->len--;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* INITMESSAGESYSTEM */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void InitMessageSystem() {
|
||||
InitQueue(&Game);
|
||||
InitQueue(&Anim);
|
||||
InitQueue(&Homo);
|
||||
for (uint8 i = 0; i < MAXMESSAGE; i++) {
|
||||
Game.event[i] = &GameMessage[i];
|
||||
Homo.event[i] = &HomoMessage[i];
|
||||
Anim.event[i] = &AnimMessage[i];
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* INITQUEUE */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void InitQueue(pqueue *lq) {
|
||||
lq->head = 0;
|
||||
lq->tail = 0;
|
||||
lq->len = 0;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* EVENT */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void doEvent(uint8 cls, uint8 event, uint8 priority,
|
||||
uint16 wparam1, uint16 wparam2,
|
||||
uint8 bparam, uint32 lparam) {
|
||||
pqueue *lq;
|
||||
|
||||
if (cls <= CLASS_GAME) lq = &Game;
|
||||
else if (cls <= CLASS_ANIM) lq = &Anim;
|
||||
else lq = &Homo;
|
||||
|
||||
if (lq->len >= MAXMESSAGE)
|
||||
return;
|
||||
|
||||
message *lm = lq->event[lq->tail++];
|
||||
|
||||
lm->cls = cls;
|
||||
lm->event = event;
|
||||
lm->priority = priority;
|
||||
lm->wparam1 = wparam1;
|
||||
lm->wparam2 = wparam2;
|
||||
lm->bparam = bparam;
|
||||
lm->lparam = lparam;
|
||||
lm->timestamp = TheTime;
|
||||
|
||||
if (lq->tail == MAXMESSAGE) lq->tail = 0;
|
||||
lq->len++;
|
||||
|
||||
if (lq == &Game)
|
||||
if (lq->len > maxmesg) maxmesg = lq->len;
|
||||
if (lq == &Anim)
|
||||
if (lq->len > maxmesa) maxmesa = lq->len;
|
||||
if (lq == &Homo)
|
||||
if (lq->len > maxmesh) maxmesh = lq->len;
|
||||
|
||||
OrderEvent(lq);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* SCHEDULER */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void Scheduler() {
|
||||
static uint8 token = CLASS_HOMO;
|
||||
static uint8 Counter;
|
||||
LLBOOL retry = true;
|
||||
|
||||
while (retry) {
|
||||
retry = false;
|
||||
switch (token) {
|
||||
|
||||
case CLASS_GAME:
|
||||
if (Counter++ <= 30) {
|
||||
token = CLASS_ANIM;
|
||||
if (GetMessage(&Game)) TheMessage = &idlemessage;
|
||||
} else {
|
||||
Counter = 0;
|
||||
TheMessage = &idlemessage;
|
||||
}
|
||||
break;
|
||||
|
||||
case CLASS_ANIM:
|
||||
token = CLASS_HOMO;
|
||||
if (GetMessage(&Anim)) retry = true;
|
||||
break;
|
||||
|
||||
case CLASS_HOMO:
|
||||
token = CLASS_GAME;
|
||||
if ((SemPaintHomo) || (GetMessage(&Homo))) retry = true;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* PROCESSTHEMESSAGE */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void ProcessTheMessage() {
|
||||
SUPEREVENT:
|
||||
switch (TheMessage->cls) {
|
||||
case MC_HOMO:
|
||||
doHomo();
|
||||
break;
|
||||
|
||||
case MC_IDLE:
|
||||
doIdle();
|
||||
break;
|
||||
|
||||
case MC_MOUSE:
|
||||
doMouse();
|
||||
break;
|
||||
|
||||
case MC_SYSTEM:
|
||||
doSystem();
|
||||
break;
|
||||
|
||||
//F case MC_ANIMATION: doAnimation(); break;
|
||||
|
||||
case MC_INVENTORY:
|
||||
doInventory();
|
||||
break;
|
||||
|
||||
case MC_ACTION:
|
||||
doAction();
|
||||
break;
|
||||
|
||||
case MC_STRING:
|
||||
doString();
|
||||
break;
|
||||
|
||||
case MC_DOING:
|
||||
doDoing();
|
||||
break;
|
||||
|
||||
case MC_DIALOG:
|
||||
doDialog();
|
||||
break;
|
||||
|
||||
case MC_SCRIPT:
|
||||
doScript();
|
||||
break;
|
||||
}
|
||||
|
||||
if (SuperEventActivate) {
|
||||
SuperEventActivate = false;
|
||||
goto SUPEREVENT;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* ORDEREVENT */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void OrderEvent(pqueue *lq) {
|
||||
uint8 pos;
|
||||
|
||||
#define PredEvent(i) (((i)==0)?MAXMESSAGE-1:((i)-1))
|
||||
|
||||
for (pos = PredEvent(lq->tail); pos != lq->head; pos = PredEvent(pos))
|
||||
if (lq->event[pos]->priority > lq->event[PredEvent(pos)]->priority) {
|
||||
if (lq->event[pos]->priority < MP_HIGH) lq->event[pos]->priority++;
|
||||
SwapMessage(lq->event[pos], lq->event[PredEvent(pos)]);
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* TESTEMPTYQUEUE */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
LLBOOL TestEmptyQueue(pqueue *lq, uint8 cls) {
|
||||
uint8 pos;
|
||||
|
||||
for (pos = lq->head; pos != lq->tail; pos = (pos == MAXMESSAGE - 1) ? 0 : pos + 1)
|
||||
if (lq->event[pos]->cls != cls) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* TESTEMPTYHOMOQUEUE4SCRIPT */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
LLBOOL TestEmptyHomoQueue4Script(pqueue *lq) {
|
||||
uint8 pos;
|
||||
|
||||
for (pos = lq->head; pos != lq->tail; pos = (pos == MAXMESSAGE - 1) ? 0 : pos + 1)
|
||||
|
||||
/* if (!(( lq->event[pos]->cls == MC_HOMO) &&
|
||||
(( lq->event[pos]->event == ME_HOMOACTION) ||
|
||||
( lq->event[pos]->event == ME_HOMOCONTINUEACTION)) &&
|
||||
( lq->event[pos]->lparam == false) &&
|
||||
( lq->event[pos]->wparam1 > DEFAULTACTIONS)))
|
||||
*/
|
||||
if (((lq->event[pos]->cls == MC_HOMO) && (lq->event[pos]->event == ME_HOMOACTION)) ||
|
||||
((lq->event[pos]->cls == MC_HOMO) && (lq->event[pos]->event == ME_HOMOGOTO)) ||
|
||||
((lq->event[pos]->cls == MC_HOMO) && (lq->event[pos]->event == ME_HOMOGOTOACTION)) ||
|
||||
((lq->event[pos]->cls == MC_HOMO) && (lq->event[pos]->event == ME_HOMOGOTOEXAMINE)) ||
|
||||
((lq->event[pos]->cls == MC_HOMO) && (lq->event[pos]->event == ME_HOMOCONTINUEACTION)))
|
||||
return false;
|
||||
|
||||
// true quando:
|
||||
// 1) la coda e' vuota
|
||||
// 2) oppure c'e' una azione particolare in corso
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* SWAPMESSAGE */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void SwapMessage(message *m1, message *m2) {
|
||||
message *tmp = m1;
|
||||
m1 = m2;
|
||||
m2 = tmp;
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
222
engines/trecision/nl/script.cpp
Normal file
222
engines/trecision/nl/script.cpp
Normal file
@ -0,0 +1,222 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "trecision/nl/lib/addtype.h"
|
||||
#include "trecision/nl/sysdef.h"
|
||||
#include "trecision/nl/struct.h"
|
||||
#include "trecision/nl/define.h"
|
||||
#include "trecision/nl/message.h"
|
||||
#include "trecision/nl/extern.h"
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
/* -----------------18/09/97 11.54-------------------
|
||||
initScript
|
||||
--------------------------------------------------*/
|
||||
void initScript() {
|
||||
int f = 0;
|
||||
|
||||
Script[s16CARD].firstframe = f;
|
||||
Script[s16CARD].flag = 0;
|
||||
|
||||
ScriptFrame[f].cls = MC_HOMO;
|
||||
ScriptFrame[f].event = ME_HOMOACTION;
|
||||
ScriptFrame[f++].wparam1 = a166USACREDITCARD;
|
||||
|
||||
ScriptFrame[f].cls = MC_ACTION;
|
||||
ScriptFrame[f].event = ME_MOUSEOPERATE;
|
||||
ScriptFrame[f++].lparam = oBIGLIETTERIA16;
|
||||
|
||||
Script[s16MONETA].firstframe = ++f;
|
||||
Script[s16MONETA].flag = 0;
|
||||
|
||||
ScriptFrame[f].cls = MC_HOMO;
|
||||
ScriptFrame[f].event = ME_HOMOACTION;
|
||||
ScriptFrame[f++].wparam1 = a167USAMONETA;
|
||||
|
||||
ScriptFrame[f].cls = MC_ACTION;
|
||||
ScriptFrame[f].event = ME_MOUSEOPERATE;
|
||||
ScriptFrame[f++].lparam = oBIGLIETTERIA16;
|
||||
|
||||
Script[s19EVA].firstframe = ++f;
|
||||
Script[s19EVA].flag = 0;
|
||||
|
||||
ScriptFrame[f].cls = MC_MOUSE;
|
||||
ScriptFrame[f].event = ME_MRIGHT;
|
||||
ScriptFrame[f].bparam = true;
|
||||
ScriptFrame[f].wparam1 = 214;
|
||||
ScriptFrame[f].wparam2 = TOP + 140;
|
||||
ScriptFrame[f++].lparam = ocEVA19;
|
||||
|
||||
Script[s4AHELLEN].firstframe = ++f;
|
||||
Script[s4AHELLEN].flag = 0;
|
||||
|
||||
ScriptFrame[f].cls = MC_HOMO;
|
||||
ScriptFrame[f].event = ME_HOMOACTION;
|
||||
ScriptFrame[f++].wparam1 = a4A2;
|
||||
|
||||
ScriptFrame[f].cls = MC_MOUSE;
|
||||
ScriptFrame[f].event = ME_MLEFT;
|
||||
ScriptFrame[f].bparam = true;
|
||||
ScriptFrame[f].wparam1 = 336;
|
||||
ScriptFrame[f].wparam2 = 263 + TOP;
|
||||
ScriptFrame[f++].lparam = 0;
|
||||
|
||||
ScriptFrame[f].cls = MC_MOUSE;
|
||||
ScriptFrame[f].event = ME_MLEFT;
|
||||
ScriptFrame[f].bparam = true;
|
||||
ScriptFrame[f].wparam1 = 336;
|
||||
ScriptFrame[f].wparam2 = 260 + TOP;
|
||||
ScriptFrame[f++].lparam = 0;
|
||||
|
||||
ScriptFrame[f].cls = MC_DIALOG;
|
||||
ScriptFrame[f].event = ME_STARTDIALOG;
|
||||
ScriptFrame[f++].wparam1 = dF4A3;
|
||||
|
||||
Script[s49MERIDIANA].firstframe = ++f;
|
||||
Script[s49MERIDIANA].flag = 0;
|
||||
|
||||
ScriptFrame[f].cls = MC_SCRIPT;
|
||||
ScriptFrame[f].event = ME_CHANGER;
|
||||
ScriptFrame[f].wparam1 = r49;
|
||||
ScriptFrame[f].wparam2 = a496;
|
||||
ScriptFrame[f].bparam = true;
|
||||
ScriptFrame[f++].lparam = 1;
|
||||
|
||||
ScriptFrame[f].cls = MC_MOUSE;
|
||||
ScriptFrame[f].event = ME_MLEFT;
|
||||
ScriptFrame[f].bparam = true;
|
||||
ScriptFrame[f].wparam1 = 360;
|
||||
ScriptFrame[f].wparam2 = 255 + TOP;
|
||||
ScriptFrame[f++].lparam = 0;
|
||||
|
||||
ScriptFrame[f].cls = MC_SCRIPT;
|
||||
ScriptFrame[f].event = ME_CHANGER;
|
||||
ScriptFrame[f].wparam1 = r4A;
|
||||
ScriptFrame[f].wparam2 = 0;
|
||||
ScriptFrame[f].bparam = true;
|
||||
ScriptFrame[f++].lparam = 1;
|
||||
|
||||
// Fast change room in double room of level 2
|
||||
Script[s21TO22].firstframe = ++f;
|
||||
Script[s21TO22].flag = 0;
|
||||
|
||||
ScriptFrame[f].cls = MC_MOUSE;
|
||||
ScriptFrame[f].wparam1 = 317;
|
||||
ScriptFrame[f].bparam = true;
|
||||
ScriptFrame[f].wparam2 = 166;
|
||||
ScriptFrame[f].event = ME_MRIGHT;
|
||||
ScriptFrame[f++].lparam = oCATENAT21;
|
||||
|
||||
ScriptFrame[f].cls = MC_MOUSE;
|
||||
ScriptFrame[f].wparam1 = 429;
|
||||
ScriptFrame[f].bparam = true;
|
||||
ScriptFrame[f].wparam2 = 194;
|
||||
ScriptFrame[f].event = ME_MLEFT;
|
||||
ScriptFrame[f++].lparam = od21ALLA22;
|
||||
|
||||
Script[s21TO23].firstframe = ++f;
|
||||
Script[s21TO23].flag = 0;
|
||||
|
||||
ScriptFrame[f].cls = MC_MOUSE;
|
||||
ScriptFrame[f].wparam1 = 317;
|
||||
ScriptFrame[f].bparam = true;
|
||||
ScriptFrame[f].wparam2 = 166;
|
||||
ScriptFrame[f].event = ME_MRIGHT;
|
||||
ScriptFrame[f++].lparam = oCATENAT21;
|
||||
|
||||
ScriptFrame[f].cls = MC_MOUSE;
|
||||
ScriptFrame[f].wparam1 = 204;
|
||||
ScriptFrame[f].bparam = true;
|
||||
ScriptFrame[f].wparam2 = 157;
|
||||
ScriptFrame[f].event = ME_MLEFT;
|
||||
ScriptFrame[f++].lparam = od21ALLA23;
|
||||
|
||||
Script[s24TO23].firstframe = ++f;
|
||||
Script[s24TO23].flag = 0;
|
||||
ScriptFrame[f].cls = MC_MOUSE;
|
||||
ScriptFrame[f].wparam1 = 316;
|
||||
ScriptFrame[f].bparam = true;
|
||||
ScriptFrame[f].wparam2 = 213;
|
||||
ScriptFrame[f].event = ME_MRIGHT;
|
||||
ScriptFrame[f++].lparam = oPASSAGGIO24;
|
||||
|
||||
ScriptFrame[f].cls = MC_MOUSE;
|
||||
ScriptFrame[f].wparam1 = 120;
|
||||
ScriptFrame[f].bparam = true;
|
||||
ScriptFrame[f].wparam2 = 196;
|
||||
ScriptFrame[f].event = ME_MLEFT;
|
||||
ScriptFrame[f++].lparam = od24ALLA23;
|
||||
|
||||
Script[s24TO26].firstframe = ++f;
|
||||
Script[s24TO26].flag = 0;
|
||||
|
||||
ScriptFrame[f].cls = MC_MOUSE;
|
||||
ScriptFrame[f].wparam1 = 316;
|
||||
ScriptFrame[f].bparam = true;
|
||||
ScriptFrame[f].wparam2 = 213;
|
||||
ScriptFrame[f].event = ME_MRIGHT;
|
||||
ScriptFrame[f++].lparam = oPASSAGGIO24;
|
||||
|
||||
ScriptFrame[f].cls = MC_MOUSE;
|
||||
ScriptFrame[f].wparam1 = 527;
|
||||
ScriptFrame[f].bparam = true;
|
||||
ScriptFrame[f].wparam2 = 187;
|
||||
ScriptFrame[f].event = ME_MLEFT;
|
||||
ScriptFrame[f++].lparam = od24ALLA26;
|
||||
|
||||
Script[s2ETO2C].firstframe = ++f;
|
||||
Script[s2ETO2C].flag = 0;
|
||||
|
||||
ScriptFrame[f].cls = MC_MOUSE;
|
||||
ScriptFrame[f].wparam1 = 420;
|
||||
ScriptFrame[f].bparam = true;
|
||||
ScriptFrame[f].wparam2 = 238;
|
||||
ScriptFrame[f].event = ME_MRIGHT;
|
||||
ScriptFrame[f++].lparam = oCATWALKA2E;
|
||||
|
||||
ScriptFrame[f].cls = MC_MOUSE;
|
||||
ScriptFrame[f].wparam1 = 66;
|
||||
ScriptFrame[f].bparam = true;
|
||||
ScriptFrame[f].wparam2 = 336;
|
||||
ScriptFrame[f].event = ME_MLEFT;
|
||||
ScriptFrame[f++].lparam = od2EALLA2C;
|
||||
|
||||
Script[s2ETO2F].firstframe = ++f;
|
||||
Script[s2ETO2F].flag = 0;
|
||||
|
||||
ScriptFrame[f].cls = MC_MOUSE;
|
||||
ScriptFrame[f].wparam1 = 420;
|
||||
ScriptFrame[f].bparam = false;
|
||||
ScriptFrame[f].wparam2 = 238;
|
||||
ScriptFrame[f].event = ME_MRIGHT;
|
||||
ScriptFrame[f++].lparam = oCATWALKA2E;
|
||||
|
||||
ScriptFrame[f].cls = MC_MOUSE;
|
||||
ScriptFrame[f].wparam1 = 213;
|
||||
ScriptFrame[f].bparam = false;
|
||||
ScriptFrame[f].wparam2 = 69;
|
||||
ScriptFrame[f].event = ME_MLEFT;
|
||||
ScriptFrame[f++].lparam = oENTRANCE2E;
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
580
engines/trecision/nl/string.cpp
Normal file
580
engines/trecision/nl/string.cpp
Normal file
@ -0,0 +1,580 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "trecision/nl/lib/addtype.h"
|
||||
#include "trecision/nl/3d/3dinc.h"
|
||||
#include "trecision/nl/sysdef.h"
|
||||
#include "trecision/nl/struct.h"
|
||||
#include "trecision/nl/define.h"
|
||||
#include "trecision/nl/message.h"
|
||||
#include "trecision/nl/extern.h"
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
// Variabili di servizio comuni a piu' funzioni di string.c
|
||||
uint16 CurS, lastinv, lastobj;
|
||||
|
||||
uint16 SpeakSomeOneAnimation;
|
||||
uint16 SpeakSomeOnePerson;
|
||||
|
||||
const char *SuperString;
|
||||
uint16 SuperStringLen;
|
||||
char SubString[MAXSUBSTRING][MAXLENSUBSTRING];
|
||||
uint16 SubStringStart;
|
||||
LLBOOL substringagain;
|
||||
uint16 CurSubString;
|
||||
uint16 SubStringUsed;
|
||||
|
||||
char sn[13];
|
||||
uint32 TalkTime;
|
||||
extern short TextON;
|
||||
extern uint16 _playingAnims[];
|
||||
const char *dunno = "?";
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* REPAINTSTRING */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void RepaintString() {
|
||||
if (!SemDialogActive && !SemDialogMenuActive && !SemSomeOneSpeak && !Semscriptactive && SemMouseEnabled) {
|
||||
if (INVAREA(my))
|
||||
doEvent(MC_INVENTORY, ME_SHOWICONNAME, MP_DEFAULT, 0, 0, 0, 0);
|
||||
else {
|
||||
CheckMask(mx, my);
|
||||
ShowObjName(_curObj, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* POSITIONSTRING */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void PositionString(uint16 x, uint16 y, const char *string, uint16 *posx, uint16 *posy, LLBOOL characterFl) {
|
||||
uint16 TheVideoLen = MAXX;
|
||||
|
||||
uint16 LenText = TextLength(string, 0);
|
||||
if (LenText > 960)
|
||||
LenText = (LenText * 2 / 5);
|
||||
else if (LenText > 320)
|
||||
LenText = (LenText * 3 / 5);
|
||||
|
||||
if (x > (LenText >> 1))
|
||||
x -= (LenText >> 1);
|
||||
else
|
||||
x = 0;
|
||||
|
||||
if (x < 5)
|
||||
*posx = 5;
|
||||
else if ((LenText + x) > (TheVideoLen - 5))
|
||||
*posx = TheVideoLen - LenText - 5;
|
||||
else
|
||||
*posx = x;
|
||||
|
||||
*posy = characterFl ? 0 : VIDEOTOP;
|
||||
*posy += y - 1; //15
|
||||
if (*posy <= VIDEOTOP)
|
||||
*posy = VIDEOTOP + 1;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* SHOWOBJNAME */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void ShowObjName(uint16 obj, LLBOOL showhide) {
|
||||
uint16 posx;
|
||||
uint16 posy;
|
||||
char locsent[256];
|
||||
|
||||
if (SemSomeOneSpeak)
|
||||
return;
|
||||
if (lastinv) {
|
||||
ClearText();
|
||||
lastinv = 0;
|
||||
}
|
||||
|
||||
if (SemUseWithStarted && !SemUseWithLocked) {
|
||||
if (!showhide) {
|
||||
ClearText();
|
||||
lastobj = obj;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_obj[_curObj]._flag & (OBJFLAG_ROOMOUT | OBJFLAG_ROOMIN)) && !(_obj[_curObj]._flag & OBJFLAG_EXAMINE))
|
||||
return;
|
||||
|
||||
strcpy(locsent, _sysSent[23]);
|
||||
if (UseWithInv[USED])
|
||||
strcat(locsent, ObjName[InvObj[UseWith[USED]]._name]);
|
||||
else if (_obj[UseWith[USED]]._mode & OBJMODE_HIDDEN)
|
||||
strcat(locsent, dunno);
|
||||
else
|
||||
strcat(locsent, ObjName[_obj[UseWith[USED]]._name]);
|
||||
|
||||
strcat(locsent, _sysSent[24]);
|
||||
if (obj && (UseWithInv[USED] || (obj != UseWith[USED]))) {
|
||||
if (_obj[obj]._mode & OBJMODE_HIDDEN)
|
||||
strcat(locsent, dunno);
|
||||
else
|
||||
strcat(locsent, ObjName[_obj[obj]._name]);
|
||||
}
|
||||
|
||||
posx = 320;
|
||||
posy = MAXY - CARHEI;
|
||||
lastobj = (obj | 0x8000);
|
||||
uint16 LenText = TextLength(locsent, 0);
|
||||
if (posx - (LenText / 2) < 2)
|
||||
posx = 2;
|
||||
else
|
||||
posx = posx - (LenText / 2);
|
||||
|
||||
if ((posx + LenText) > SCREENLEN - 2)
|
||||
posx = SCREENLEN - 2 - LenText;
|
||||
|
||||
if (lastobj)
|
||||
ClearText();
|
||||
Text(posx, posy, locsent, COLOR_INVENTORY, MASKCOL);
|
||||
} else {
|
||||
if ((!obj) || (!showhide)) {
|
||||
ClearText();
|
||||
lastobj = obj;
|
||||
return;
|
||||
}
|
||||
|
||||
if (obj == lastobj)
|
||||
return;
|
||||
if (!(_obj[obj]._flag & OBJFLAG_EXAMINE)) {
|
||||
if ((_obj[obj]._flag & OBJFLAG_DONE) || (Room[_obj[obj]._goRoom]._flag & OBJFLAG_DONE)) {
|
||||
strcpy(locsent, _sysSent[25]);
|
||||
if (_obj[obj]._mode & OBJMODE_HIDDEN)
|
||||
strcat(locsent, dunno);
|
||||
else
|
||||
strcat(locsent, ObjName[_obj[obj]._name]);
|
||||
} else
|
||||
strcpy(locsent, _sysSent[26]);
|
||||
} else if (_obj[obj]._mode & OBJMODE_HIDDEN)
|
||||
strcpy(locsent, dunno);
|
||||
else
|
||||
strcpy(locsent, ObjName[_obj[obj]._name]);
|
||||
|
||||
switch (obj) {
|
||||
case oRUOTE2C:
|
||||
posx = (_obj[obj]._lim[0] + _obj[obj]._lim[2]) / 2;
|
||||
posy = 187;
|
||||
break;
|
||||
|
||||
default:
|
||||
posx = (_obj[obj]._lim[0] + _obj[obj]._lim[2]) / 2;
|
||||
posy = _obj[obj]._lim[1];
|
||||
break;
|
||||
}
|
||||
PositionString(posx, posy, locsent, &posx, &posy, false);
|
||||
if (lastobj)
|
||||
ClearText();
|
||||
lastobj = obj;
|
||||
Text(posx, posy, locsent, COLOR_OBJECT, MASKCOL);
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* SHOWINVNAME */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void ShowInvName(uint16 obj, LLBOOL showhide) {
|
||||
uint16 posx;
|
||||
uint16 posy;
|
||||
uint16 LenText;
|
||||
|
||||
if ((_curRoom == r2BL) || (_curRoom == r36F) || (_curRoom == r41D) || (_curRoom == r49M) || (_curRoom == r4CT) ||
|
||||
(_curRoom == r58T) || (_curRoom == r58M) || (_curRoom == r59L) || (_curRoom == rSYS) || (_curRoom == r12CU) || (_curRoom == r13CU))
|
||||
return;
|
||||
|
||||
if (SemSomeOneSpeak)
|
||||
return;
|
||||
if (lastobj) {
|
||||
ClearText();
|
||||
lastobj = 0;
|
||||
}
|
||||
|
||||
if (SemUseWithStarted && !SemUseWithLocked) {
|
||||
if (/*(!obj) ||*/ (!showhide)) {
|
||||
ClearText();
|
||||
lastinv = 0;
|
||||
return;
|
||||
}
|
||||
if ((obj | 0x8000) == lastinv)
|
||||
return;
|
||||
|
||||
char locsent[256];
|
||||
strcpy(locsent, _sysSent[23]);
|
||||
if (UseWithInv[USED]) {
|
||||
strcat(locsent, ObjName[InvObj[UseWith[USED]]._name]);
|
||||
strcat(locsent, _sysSent[24]);
|
||||
if (obj && (InvObj[UseWith[USED]]._name != InvObj[obj]._name))
|
||||
strcat(locsent, ObjName[InvObj[obj]._name]);
|
||||
} else {
|
||||
if (_obj[UseWith[USED]]._mode & OBJMODE_HIDDEN)
|
||||
strcat(locsent, dunno);
|
||||
else
|
||||
strcat(locsent, ObjName[_obj[UseWith[USED]]._name]);
|
||||
strcat(locsent, _sysSent[24]);
|
||||
if (obj && (_obj[UseWith[USED]]._name != InvObj[obj]._name))
|
||||
strcat(locsent, ObjName[InvObj[obj]._name]);
|
||||
}
|
||||
posx = 320;
|
||||
// posx = ICONMARGSX+((IconPos(UseWith[USED])-TheIconBase)*(ICONDX))+ICONDX/2;
|
||||
posy = MAXY - CARHEI;
|
||||
lastinv = (obj | 0x8000);
|
||||
LenText = TextLength(locsent, 0);
|
||||
if (posx - (LenText / 2) < 2)
|
||||
posx = 2;
|
||||
else
|
||||
posx = posx - (LenText / 2);
|
||||
|
||||
if ((posx + LenText) > SCREENLEN - 2)
|
||||
posx = SCREENLEN - 2 - LenText;
|
||||
|
||||
if (lastinv)
|
||||
ClearText();
|
||||
Text(posx, posy, locsent, COLOR_INVENTORY, MASKCOL);
|
||||
} else {
|
||||
if (obj == lastinv)
|
||||
return;
|
||||
|
||||
if (!obj || !showhide) {
|
||||
ClearText();
|
||||
lastinv = 0;
|
||||
return;
|
||||
}
|
||||
posx = ICONMARGSX + ((IconPos(CurInventory) - TheIconBase) * (ICONDX)) + ICONDX / 2;
|
||||
posy = MAXY - CARHEI;
|
||||
lastinv = obj;
|
||||
LenText = TextLength(ObjName[InvObj[obj]._name], 0);
|
||||
if (posx - (LenText / 2) < 2)
|
||||
posx = 2;
|
||||
else
|
||||
posx = posx - (LenText / 2);
|
||||
|
||||
if ((posx + LenText) > SCREENLEN - 2)
|
||||
posx = SCREENLEN - 2 - LenText;
|
||||
|
||||
if (lastinv)
|
||||
ClearText();
|
||||
|
||||
if (InvObj[obj]._name)
|
||||
Text(posx, posy, ObjName[InvObj[obj]._name], COLOR_INVENTORY, MASKCOL);
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* FORMATTINGSUPERSTRING */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void FormattingSuperString() {
|
||||
SubStringUsed = 0;
|
||||
substringagain = true;
|
||||
while (substringagain) {
|
||||
FormattingOneString();
|
||||
SubStringUsed++;
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------08/07/97 22.23-------------------
|
||||
FormattingOneString
|
||||
--------------------------------------------------*/
|
||||
void FormattingOneString() {
|
||||
uint16 i;
|
||||
memset(SubString[SubStringUsed], '\0', MAXLENSUBSTRING);
|
||||
|
||||
uint16 SpazioRimasto = (SuperStringLen - SubStringStart);
|
||||
for (i = 0; i < SpazioRimasto; i++) {
|
||||
switch (SuperString[i + SubStringStart]) {
|
||||
case '\0':
|
||||
substringagain = false;
|
||||
return;
|
||||
|
||||
case '@':
|
||||
substringagain = true;
|
||||
SubStringStart += (i + 1);
|
||||
return;
|
||||
|
||||
default:
|
||||
SubString[SubStringUsed][i] = SuperString[i + SubStringStart];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SubString[SubStringUsed][i] = '\0';
|
||||
substringagain = false;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* characterSay */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void CharacterSay(uint16 i) {
|
||||
CurS = i;
|
||||
|
||||
// TODO: Use a define... ************************
|
||||
Semskipenable = (i != 99999);
|
||||
|
||||
// if he took some action
|
||||
if ((Sentence[i][0] == '*') && (_playingAnims[1] == 0))
|
||||
StartCharacterAction(hBOH, 0, 0, 0);
|
||||
else
|
||||
CharacterTalk(Sentence[i], true);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* CharacterTalk */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void CharacterTalk(const char *s, LLBOOL FromCharacterSay) {
|
||||
SemSomeOneSpeak = true;
|
||||
SemCharacterSpeak = true;
|
||||
Semskiptalk = false;
|
||||
|
||||
SuperString = s;
|
||||
SuperStringLen = strlen(SuperString);
|
||||
SubStringStart = 0;
|
||||
CurSubString = 0;
|
||||
FormattingSuperString();
|
||||
|
||||
if (!FromCharacterSay)
|
||||
Semskipenable = true;
|
||||
|
||||
CharacterContinueTalk();
|
||||
|
||||
InitQueue(&Homo);
|
||||
actorStop();
|
||||
}
|
||||
|
||||
/* -----------------08/07/97 22.26-------------------
|
||||
CharacterTalkInAction
|
||||
--------------------------------------------------*/
|
||||
void CharacterTalkInAction(uint16 ss) {
|
||||
const char *s = Sentence[ss];
|
||||
|
||||
if (Sentence[ss][0] == '*')
|
||||
return;
|
||||
CurS = ss;
|
||||
|
||||
SemSomeOneSpeak = true;
|
||||
SemCharacterSpeak = true;
|
||||
Semskiptalk = false;
|
||||
Semskipenable = true;
|
||||
|
||||
SuperString = s;
|
||||
SuperStringLen = strlen(SuperString);
|
||||
SubStringStart = 0;
|
||||
CurSubString = 0;
|
||||
FormattingSuperString();
|
||||
|
||||
CharacterContinueTalk();
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* CharacterContinueTalk */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void CharacterContinueTalk() {
|
||||
uint16 posx, posy;
|
||||
|
||||
Semskiptalk = false;
|
||||
CharacterSpeakTime = TheTime;
|
||||
|
||||
substringagain = (CurSubString < (SubStringUsed - 1));
|
||||
|
||||
if (SemCharacterExist)
|
||||
PositionString(_actor._lim[0], _actor._lim[2], SubString[CurSubString], &posx, &posy, true);
|
||||
else
|
||||
PositionString(MAXX / 2, 30, SubString[CurSubString], &posx, &posy, false);
|
||||
|
||||
ClearText();
|
||||
if (TextON)
|
||||
Text(posx, posy, SubString[CurSubString], COLOR_OBJECT, MASKCOL);
|
||||
|
||||
if (!SemDialogActive) {
|
||||
if (CurSubString)
|
||||
sprintf(sn, "s%04d%c.wav", CurS, CurSubString + 'a');
|
||||
else
|
||||
sprintf(sn, "s%04d.wav", CurS);
|
||||
}
|
||||
|
||||
TalkTime = Talk(sn);
|
||||
if (!TalkTime)
|
||||
TalkTime = (strlen(SubString[CurSubString]) * 5) / 2 + 50;
|
||||
|
||||
CurSubString++;
|
||||
|
||||
doEvent(MC_STRING, ME_HOMOSPEAKING, MP_DEFAULT, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* CharacterMute */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void CharacterMute() {
|
||||
SemSomeOneSpeak = false;
|
||||
SemCharacterSpeak = false;
|
||||
Semskiptalk = false;
|
||||
CharacterSpeakTime = 0L;
|
||||
|
||||
ClearText();
|
||||
lastobj = 0;
|
||||
lastinv = 0;
|
||||
|
||||
RepaintString();
|
||||
StopTalk();
|
||||
|
||||
if ((_curRoom == r12CU) || (_curRoom == r13CU))
|
||||
doEvent(MC_SYSTEM, ME_CHANGEROOM, MP_SYSTEM, OldRoom, 0, 0, _curObj);
|
||||
|
||||
// actorStop();
|
||||
// if(SemDialogActive) doEvent(MC_DIALOG,ME_FINEBATTUTA,MP_DEFAULT,0,0,0,0);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* SOMEONETALK */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void SomeOneTalk(uint16 s, uint16 Person, uint16 NewAnim, LLBOOL FromSomeOneSay) {
|
||||
SpeakSomeOneAnimation = NewAnim;
|
||||
SpeakSomeOnePerson = Person;
|
||||
SemSomeOneSpeak = true;
|
||||
Semskiptalk = false;
|
||||
|
||||
CurS = s;
|
||||
SuperString = Sentence[s];
|
||||
SuperStringLen = strlen(SuperString);
|
||||
SubStringStart = 0;
|
||||
CurSubString = 0;
|
||||
|
||||
if (!FromSomeOneSay)
|
||||
Semskipenable = true;
|
||||
|
||||
FormattingSuperString();
|
||||
|
||||
if (SpeakSomeOneAnimation)
|
||||
doEvent(MC_ANIMATION, ME_ADDANIM, MP_SYSTEM, SpeakSomeOneAnimation, 0, 0, 0);
|
||||
doEvent(MC_STRING, ME_SOMEONEWAIT2SPEAK, MP_DEFAULT, SpeakSomeOneAnimation, 0, 0, 0);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* SOMEONECONTINUETALK */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void SomeOneContinueTalk() {
|
||||
uint16 posx, posy;
|
||||
|
||||
SomeOneSpeakTime = TheTime;
|
||||
Semskiptalk = false;
|
||||
|
||||
substringagain = (CurSubString < (SubStringUsed - 1));
|
||||
|
||||
if (SpeakSomeOnePerson)
|
||||
PositionString(_obj[SpeakSomeOnePerson]._lim[0], _obj[SpeakSomeOnePerson]._lim[1], SubString[CurSubString], &posx, &posy, false);
|
||||
else
|
||||
PositionString(_actor._lim[0], _actor._lim[2], SubString[CurSubString], &posx, &posy, true);
|
||||
|
||||
ClearText();
|
||||
if (TextON)
|
||||
Text(posx, posy, SubString[CurSubString], HYELLOW, MASKCOL);
|
||||
|
||||
if (CurSubString)
|
||||
sprintf(sn, "s%04d%c.wav", CurS, CurSubString + 'a');
|
||||
else
|
||||
sprintf(sn, "s%04d.wav", CurS);
|
||||
// sprintf(sn,"d%02d%03d%02d",_curDialog,_subTitles[_curSubTitle]._sentence,CurSubString);
|
||||
TalkTime = Talk(sn);
|
||||
if (!TalkTime)
|
||||
TalkTime = (strlen(SubString[CurSubString]) * 5) / 2 + 50;
|
||||
|
||||
CurSubString++;
|
||||
doEvent(MC_STRING, ME_SOMEONESPEAKING, MP_DEFAULT, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* SOMEONEMUTE */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void SomeOneMute() {
|
||||
SemCharacterSpeak = false;
|
||||
Semskiptalk = false;
|
||||
SemSomeOneSpeak = false;
|
||||
SomeOneSpeakTime = 0L;
|
||||
|
||||
ClearText();
|
||||
lastobj = 0;
|
||||
lastinv = 0;
|
||||
|
||||
RepaintString();
|
||||
StopTalk();
|
||||
|
||||
//F if(SemDialogActive) doEvent(MC_DIALOG,ME_FINEBATTUTA,MP_DEFAULT,0,0,0,0);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* DOSTRING */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void doString() {
|
||||
switch (TheMessage->event) {
|
||||
case ME_HOMOSPEAK:
|
||||
CharacterSay(TheMessage->wparam1);
|
||||
break;
|
||||
|
||||
case ME_HOMOSPEAKING:
|
||||
if (SemCharacterSpeak) {
|
||||
if (Semskiptalk || (TheTime > (TalkTime + CharacterSpeakTime))) {
|
||||
if (substringagain)
|
||||
CharacterContinueTalk();
|
||||
else
|
||||
CharacterMute();
|
||||
} else {
|
||||
// actorDoNextFrame();
|
||||
REEVENT;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ME_SOMEONEWAIT2SPEAK:
|
||||
if ((!TheMessage->wparam1) /*FAB: || (AnimObj[TheMessage->wparam1]._flag & ONOFF)*/)
|
||||
SomeOneContinueTalk();
|
||||
else
|
||||
REEVENT;
|
||||
break;
|
||||
|
||||
case ME_SOMEONEWAIT2MUTE:
|
||||
if ((!TheMessage->wparam1) /*FAB: || (!(AnimObj[TheMessage->wparam1]._flag & ONOFF))*/)
|
||||
SomeOneMute();
|
||||
else
|
||||
REEVENT;
|
||||
break;
|
||||
|
||||
case ME_SOMEONESPEAKING:
|
||||
if (SemSomeOneSpeak) {
|
||||
if (Semskiptalk || (TheTime >= (TalkTime + SomeOneSpeakTime))) {
|
||||
if (substringagain)
|
||||
SomeOneContinueTalk();
|
||||
else {
|
||||
if (SpeakSomeOneAnimation)
|
||||
doEvent(MC_ANIMATION, ME_DELANIM, MP_SYSTEM, SpeakSomeOneAnimation, true, 0, 0);
|
||||
doEvent(MC_STRING, ME_SOMEONEWAIT2MUTE, MP_DEFAULT, SpeakSomeOneAnimation, 0, 0, 0);
|
||||
}
|
||||
} else
|
||||
REEVENT;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
184
engines/trecision/nl/struct.h
Normal file
184
engines/trecision/nl/struct.h
Normal file
@ -0,0 +1,184 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
/* -----------------08/07/97 21.43-------------------
|
||||
Structures definitions
|
||||
--------------------------------------------------*/
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
struct SRoom {
|
||||
int8 _baseName[4]; // Room name
|
||||
uint8 _flag; // Room visited or not
|
||||
uint16 _bkgAnim; // Background animation
|
||||
uint16 _object[MAXOBJINROOM]; // Objects in the room
|
||||
uint16 _sounds[MAXSOUNDSINROOM]; // Sounds of the room
|
||||
uint16 _actions[MAXACTIONINROOM]; // Character actions in the room
|
||||
};
|
||||
|
||||
struct SObject {
|
||||
uint16 _dx, _dy;
|
||||
uint16 _px, _py;
|
||||
uint16 _lim[4];
|
||||
int8 _position; // -1 if no position
|
||||
uint16 _name;
|
||||
uint16 _examine;
|
||||
uint16 _action;
|
||||
uint8 _goRoom; // If direction room num - if person num dialog
|
||||
uint8 _nbox; // Which 3d box the object is associated with
|
||||
uint8 _ninv; // ptr inventory
|
||||
uint8 _mode; /* 0- full
|
||||
1- mask
|
||||
2- limits
|
||||
3- objStatus
|
||||
6- center when click !
|
||||
7- inventory referenceable */
|
||||
uint8 _flag; /* Examine = 0
|
||||
Direction = 1
|
||||
Person = 2
|
||||
Carried = 3
|
||||
2- Take
|
||||
3- Open
|
||||
4- Close
|
||||
5- Use
|
||||
6- Extra
|
||||
7- Operated */
|
||||
uint16 _anim;
|
||||
};
|
||||
|
||||
struct SInvObject {
|
||||
uint16 _name; // Object name in the inventory
|
||||
uint16 _examine; // Sentence if examined
|
||||
uint16 _action;
|
||||
uint8 _flag; /* 0-
|
||||
1-
|
||||
2-
|
||||
3- Open
|
||||
4- Close
|
||||
5- Use (SET=use OFF & notSET open and close = use with)
|
||||
6- Extra
|
||||
7- Operated */
|
||||
uint16 _anim;
|
||||
};
|
||||
|
||||
struct SAtFrame {
|
||||
uint8 type; //ATFTEXT, ATFSND, ATFEVENT
|
||||
uint8 child; // 0 1 2 3 4
|
||||
uint16 nframe;
|
||||
uint16 index;
|
||||
};
|
||||
|
||||
struct SAnim {
|
||||
char name[14];
|
||||
uint16 flag; // 1- se e' background 2- se e' icona
|
||||
// 3- se e' actionomino 4- se e' attiva 4bits per i figli
|
||||
uint16 lim[MAXCHILD][4];
|
||||
uint8 nbox;
|
||||
struct SAtFrame atframe[MAXATFRAME];
|
||||
};
|
||||
|
||||
/*PELS: DIALOG VERSION PELS. ***************************/
|
||||
|
||||
typedef struct {
|
||||
uint16 _sentence;
|
||||
uint16 _x, _y, _color; // you can compact this info using a bit field
|
||||
uint16 _startFrame, _length; // Frame at which the subtitle starts and its length
|
||||
} DialogSubTitle;
|
||||
|
||||
typedef struct {
|
||||
uint16 _flag; // DLGCHOICE_HIDE|DLGCHOICE_ONETIME|DLGCHOICE_FRAUD...if used...
|
||||
uint16 _sentenceIndex; // Index in the sentence array.
|
||||
uint16 _firstSubTitle, _subTitleNumb; // starting index and number of sub title sentences
|
||||
uint16 _on[MAXDISPSCELTE], _off[MAXDISPSCELTE];
|
||||
uint16 _startFrame; // Starting frame of the choice
|
||||
uint16 _nextDialog;
|
||||
} DialogChoice;
|
||||
|
||||
typedef struct {
|
||||
uint16 _flag; // DONT_SKIP .. and more
|
||||
uint16 _interlocutor; // Person I'm talking to... Maybe it's not needed
|
||||
int8 _startAnim[14]; // aANIMATION or text table index by filename.
|
||||
uint16 _startLen;
|
||||
uint16 _firstChoice;
|
||||
uint16 _choiceNumb;
|
||||
uint16 _newPal[MAXNEWSMKPAL];
|
||||
} Dialog;
|
||||
|
||||
|
||||
// MESSAGGI PER LO SCHEDULER
|
||||
typedef struct tagMessage {
|
||||
uint8 cls ; // message class
|
||||
uint8 event ; // message name
|
||||
uint8 priority ; // message priority
|
||||
|
||||
uint8 bparam;
|
||||
uint16 wparam1 ; // byte parameter 1
|
||||
uint16 wparam2 ; // byte parameter 2
|
||||
uint32 lparam ; // int parameter
|
||||
uint32 timestamp;
|
||||
} message;
|
||||
|
||||
// RETTANGOLO DI SCHERMO (no erase, please!)
|
||||
struct screenrect {
|
||||
uint16 x0, y0, x1, y1;
|
||||
};
|
||||
|
||||
typedef struct queue {
|
||||
uint8 head, tail, len;
|
||||
message *event[MAXMESSAGE];
|
||||
} pqueue;
|
||||
|
||||
struct SSortTable {
|
||||
uint16 index; // indice nell' elenco
|
||||
uint16 typology; // tipo di bitmap
|
||||
LLBOOL togli; // se copiare o togliere
|
||||
uint16 roomindex; // indice nella room
|
||||
uint16 framecur; // frame corrente se animazione
|
||||
};
|
||||
|
||||
struct SScriptFrame {
|
||||
uint8 cls;
|
||||
uint8 event;
|
||||
|
||||
uint8 bparam;
|
||||
|
||||
uint16 wparam1;
|
||||
uint16 wparam2;
|
||||
|
||||
uint16 lparam;
|
||||
|
||||
LLBOOL nowait;
|
||||
};
|
||||
|
||||
struct SScript {
|
||||
uint16 firstframe;
|
||||
uint8 flag; // 0 - BREAKABLE - Se si interrompe con la pressione dei tasti del mouse
|
||||
}; // 1 - DIALOGEXITNOANIM - Se lo script e' lanciato da un dialogo all'ultima battuta esce dal dialogo senza anim di link e di default
|
||||
|
||||
struct SSound {
|
||||
char name[14];
|
||||
uint8 volume;
|
||||
uint8 flag;
|
||||
int8 panning;
|
||||
};
|
||||
|
||||
} // End of namespace Trecision
|
653
engines/trecision/nl/sys/anim.cpp
Normal file
653
engines/trecision/nl/sys/anim.cpp
Normal file
@ -0,0 +1,653 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
//#include <dos.h>
|
||||
#include <conio.h>
|
||||
|
||||
#include "trecision/nl/lib/addtype.h"
|
||||
#include "trecision/nl/sysdef.h"
|
||||
#include "trecision/nl/struct.h"
|
||||
#include "trecision/nl/extern.h"
|
||||
#include "trecision/nl/define.h"
|
||||
#include "trecision/nl/message.h"
|
||||
#include "trecision/nl/ll/llinc.h"
|
||||
|
||||
#include "backends/fs/stdiostream.h"
|
||||
#include "graphics/pixelformat.h"
|
||||
#include "graphics/surface.h"
|
||||
#include "video/smk_decoder.h"
|
||||
#include "common/system.h"
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
class NightlongSmackerDecoder : public Video::SmackerDecoder {
|
||||
public:
|
||||
bool loadStream(Common::SeekableReadStream *stream) override {
|
||||
if (Video::SmackerDecoder::loadStream(stream)) {
|
||||
// Map audio tracks to sound types
|
||||
for (uint32 i = 0; i < 8; i++) {
|
||||
Track *t = getTrack(i);
|
||||
if (t && t->getTrackType() == Track::kTrackTypeAudio) {
|
||||
AudioTrack *audio = (AudioTrack *)t;
|
||||
audio->setMute(false);
|
||||
audio->setSoundType(i == 7 ? Audio::Mixer::kSpeechSoundType : Audio::Mixer::kSFXSoundType);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void muteTrack(uint track, bool mute) {
|
||||
Track *t = getTrack(track);
|
||||
if (t && t->getTrackType() == Track::kTrackTypeAudio) {
|
||||
((AudioTrack *)t)->setMute(mute);
|
||||
}
|
||||
}
|
||||
|
||||
void setMute(bool mute) {
|
||||
for (TrackList::iterator it = getTrackListBegin(); it != getTrackListEnd(); it++)
|
||||
if ((*it)->getTrackType() == Track::kTrackTypeAudio)
|
||||
((AudioTrack *)*it)->setMute(mute);
|
||||
}
|
||||
};
|
||||
|
||||
struct SDText sdt, osdt;
|
||||
|
||||
// locals
|
||||
#define SMACKNULL 0
|
||||
#define SMACKOPEN 1
|
||||
#define SMACKCLOSE 2
|
||||
#define MAXSMACK 3
|
||||
|
||||
extern uint8 *SmackBuffer[MAXSMACK];
|
||||
|
||||
extern uint16 _smackPal[MAXSMACK][256];
|
||||
extern uint8 _curSmackAction;
|
||||
extern uint8 _curSmackBuffer;
|
||||
|
||||
extern uint16 _playingAnims[MAXSMACK];
|
||||
extern uint16 _curAnimFrame[MAXSMACK];
|
||||
extern uint16 _numPlayingAnims;
|
||||
extern uint16 _newData[260];
|
||||
extern uint32 _newData2[260];
|
||||
|
||||
NightlongSmackerDecoder *SmkAnims[MAXSMACK];
|
||||
extern uint16 _animMaxX, _animMinX, _animMaxY, _animMinY;
|
||||
extern Graphics::PixelFormat ScreenFormat;
|
||||
extern short SpeechVol, SFxVol, SpeechON, TextON;
|
||||
|
||||
// from regen.c
|
||||
extern int16 limiti[20][4];
|
||||
extern uint16 limitinum;
|
||||
extern int Hlim;
|
||||
extern const char *_sysSent[];
|
||||
|
||||
/*-----------------18/01/97 21.05-------------------
|
||||
CallSmackOpen
|
||||
--------------------------------------------------*/
|
||||
void CallSmackOpen(const char *name) {
|
||||
SmkAnims[_curSmackBuffer] = new NightlongSmackerDecoder();
|
||||
|
||||
if (!SmkAnims[_curSmackBuffer]->loadStream(new StdioStream((void *)name))) {
|
||||
warning("Invalid SMK file");
|
||||
CallSmackClose();
|
||||
} else {
|
||||
SmkAnims[_curSmackBuffer]->start();
|
||||
CallSmackNextFrame();
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------18/01/97 21.05-------------------
|
||||
CallSmackClose
|
||||
--------------------------------------------------*/
|
||||
void CallSmackClose() {
|
||||
if (SmkAnims[_curSmackBuffer] == NULL)
|
||||
return;
|
||||
|
||||
delete SmkAnims[_curSmackBuffer];
|
||||
SmkAnims[_curSmackBuffer] = NULL;
|
||||
}
|
||||
|
||||
/*-----------------18/01/97 21.05-------------------
|
||||
CallSmackNextFrame
|
||||
--------------------------------------------------*/
|
||||
void CallSmackNextFrame() {
|
||||
if (SmkAnims[_curSmackBuffer] == NULL)
|
||||
return;
|
||||
|
||||
if (SmkAnims[_curSmackBuffer]->needsUpdate()) {
|
||||
const Graphics::Surface *surface = SmkAnims[_curSmackBuffer]->decodeNextFrame();
|
||||
if (surface != NULL)
|
||||
SmackBuffer[_curSmackBuffer] = (uint8 *)surface->getPixels();
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------18/01/97 21.05-------------------
|
||||
CallSmackVolumePan
|
||||
--------------------------------------------------*/
|
||||
void CallSmackVolumePan(int buf, int track, int vol) {
|
||||
_curSmackBuffer = buf;
|
||||
|
||||
if (SmkAnims[_curSmackBuffer] == NULL)
|
||||
return;
|
||||
|
||||
SmkAnims[_curSmackBuffer]->muteTrack(track, vol == 0);
|
||||
}
|
||||
|
||||
/* -----------------23/06/98 13.33-------------------
|
||||
* CallSmackGoto
|
||||
* --------------------------------------------------*/
|
||||
void CallSmackGoto(int buf, int num) {
|
||||
_curSmackBuffer = buf;
|
||||
|
||||
if (SmkAnims[_curSmackBuffer] == NULL)
|
||||
return;
|
||||
|
||||
SmkAnims[_curSmackBuffer]->seekToFrame(num);
|
||||
}
|
||||
|
||||
/* -----------------07/08/98 14.47-------------------
|
||||
* CallSmackSounOnOff
|
||||
* --------------------------------------------------*/
|
||||
void CallSmackSoundOnOff(int pos, int on) {
|
||||
if (SmkAnims[pos] == NULL)
|
||||
return;
|
||||
|
||||
SmkAnims[pos]->setMute(on == 0);
|
||||
}
|
||||
|
||||
/* -----------------12/06/97 17.09-------------------
|
||||
PalTo16bit
|
||||
--------------------------------------------------*/
|
||||
uint16 PalTo16bit(uint8 r, uint8 g, uint8 b) {
|
||||
return (uint16)ScreenFormat.RGBToColor(r, g, b);
|
||||
}
|
||||
|
||||
/* -----------------09/09/97 18.02-------------------
|
||||
RefreshAllAnimations
|
||||
--------------------------------------------------*/
|
||||
void RefreshAllAnimations() {
|
||||
soundtimefunct();
|
||||
|
||||
for (int a = 0; a < MAXSMACK; a++) {
|
||||
if (_playingAnims[a]) {
|
||||
_curSmackBuffer = a;
|
||||
CallSmackNextFrame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------17/11/96 14.50-------------------
|
||||
RegenSmackAnim
|
||||
--------------------------------------------------*/
|
||||
void RegenSmackAnim(int num) {
|
||||
extern unsigned char RegenInvStartIcon;
|
||||
int32 a;
|
||||
int pos = 0;
|
||||
|
||||
if ((num == 0) || (num == 620))
|
||||
return;
|
||||
|
||||
if (AnimTab[num].flag & SMKANIM_ICON) {
|
||||
RegenSmackIcon(RegenInvStartIcon, num);
|
||||
return;
|
||||
}
|
||||
|
||||
while ((pos < MAXSMACK) && (_playingAnims[pos] != num))
|
||||
pos++;
|
||||
|
||||
if (pos >= MAXSMACK) {
|
||||
if (AnimTab[num].flag & SMKANIM_BKG)
|
||||
pos = 0;
|
||||
else if (AnimTab[num].flag & SMKANIM_ICON)
|
||||
pos = 2;
|
||||
else
|
||||
pos = 1;
|
||||
}
|
||||
|
||||
_curSmackBuffer = pos;
|
||||
|
||||
if (SmkAnims[_curSmackBuffer] == NULL)
|
||||
return;
|
||||
|
||||
_curAnimFrame[pos] ++;
|
||||
|
||||
if (SmkAnims[pos]->hasDirtyPalette()) {
|
||||
for (a = 0; a < 256; a++)
|
||||
_smackPal[pos][a] = PalTo16bit(SmkAnims[pos]->getPalette()[a * 3 + 0], SmkAnims[pos]->getPalette()[a * 3 + 1], SmkAnims[pos]->getPalette()[a * 3 + 2]);
|
||||
}
|
||||
|
||||
//SmackDoFrame( SmkAnims[pos] );
|
||||
//SmackToBuffer( SmkAnims[pos], 0, 0,
|
||||
// SmkAnims[pos]->getWidth(), SmkAnims[pos]->getHeight(), SmackBuffer[pos], 0 );
|
||||
|
||||
//while( SmackToBufferRect( SmkAnims[pos], SMACKSURFACEFAST ) )
|
||||
{
|
||||
int inters = 0;
|
||||
for (a = 0; a < MAXCHILD; a++) {
|
||||
if (AnimTab[num].flag & (SMKANIM_OFF1 << a)) {
|
||||
// se il rettangolo e' completamente dentro a limite lo leva
|
||||
if ((AnimTab[num].lim[a][0] <= 0 + SmkAnims[pos]->getWidth()) &&
|
||||
(AnimTab[num].lim[a][1] <= 0 + SmkAnims[pos]->getHeight()) &&
|
||||
(AnimTab[num].lim[a][2] >= 0) &&
|
||||
(AnimTab[num].lim[a][3] >= 0)) {
|
||||
inters ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((_curAnimFrame[pos] > 0) && (inters == 0)) {
|
||||
if (pos == 0) {
|
||||
for (a = 0; a < SmkAnims[pos]->getHeight(); a++) {
|
||||
/*byte2wordn( Video2+0+(0+a+TOP)*MAXX,
|
||||
SmackBuffer[pos]+0+(0+a)*SmkAnims[pos]->getWidth(),
|
||||
_smackPal[pos],SmkAnims[pos]->getWidth());
|
||||
|
||||
AddLine(0,0+SmkAnims[pos]->getWidth(),0+a+TOP);
|
||||
|
||||
wordcopy( ImagePointer+0+(0+a)*MAXX,
|
||||
Video2+0+(0+a+TOP)*MAXX,
|
||||
SmkAnims[pos]->getWidth());*/
|
||||
}
|
||||
} else if (_curAnimFrame[pos] > 1) {
|
||||
_animMinX = (_animMinX > 0) ? 0 : _animMinX;
|
||||
_animMinY = (_animMinY > 0) ? 0 : _animMinY;
|
||||
|
||||
_animMaxX = (_animMaxX < 0 + SmkAnims[pos]->getWidth()) ? 0 + SmkAnims[pos]->getWidth() : _animMaxX;
|
||||
_animMaxY = (_animMaxY < 0 + SmkAnims[pos]->getHeight()) ? 0 + SmkAnims[pos]->getHeight() : _animMaxY;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// se e' un background
|
||||
if (pos == 0) {
|
||||
for (a = 0; a < MAXCHILD; a++) {
|
||||
if (!(AnimTab[num].flag & (SMKANIM_OFF1 << a)) && (AnimTab[num].lim[a][3] != 0)) {
|
||||
limiti[limitinum][0] = AnimTab[num].lim[a][0];
|
||||
limiti[limitinum][1] = AnimTab[num].lim[a][1] + TOP;
|
||||
limiti[limitinum][2] = AnimTab[num].lim[a][2];
|
||||
limiti[limitinum][3] = AnimTab[num].lim[a][3] + TOP;
|
||||
limitinum ++;
|
||||
}
|
||||
}
|
||||
} // solo per l'omino
|
||||
else if (pos == 1) {
|
||||
if (_curAnimFrame[pos] == 1) {
|
||||
for (int32 b = 0; b < AREA; b++) {
|
||||
for (a = 0; a < MAXX; a++) {
|
||||
if (SmackBuffer[pos][b * MAXX + a]) {
|
||||
_animMinX = (_animMinX > a) ? a : _animMinX;
|
||||
_animMinY = (_animMinY > b) ? b : _animMinY;
|
||||
|
||||
_animMaxX = (_animMaxX < a) ? a : _animMaxX;
|
||||
_animMaxY = (_animMaxY < b) ? b : _animMaxY;
|
||||
}
|
||||
}
|
||||
|
||||
_animMaxX = (_animMaxX + 1 > MAXX) ? MAXX : _animMaxX + 1;
|
||||
_animMaxY = (_animMaxY + 1 > AREA) ? AREA : _animMaxY + 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (a = 0; a < (_animMaxY - _animMinY); a++) {
|
||||
byte2wordm(Video2 + _animMinX + (_animMinY + a + TOP)*MAXX,
|
||||
SmackBuffer[pos] + _animMinX + (_animMinY + a)*SmkAnims[pos]->getWidth(),
|
||||
_smackPal[pos], _animMaxX - _animMinX);
|
||||
|
||||
AddLine(_animMinX, _animMaxX, _animMinY + a + TOP);
|
||||
}
|
||||
|
||||
limiti[limitinum][0] = _animMinX;
|
||||
limiti[limitinum][1] = _animMinY + TOP;
|
||||
limiti[limitinum][2] = _animMaxX;
|
||||
limiti[limitinum][3] = _animMaxY + TOP;
|
||||
|
||||
Hlim = limitinum;
|
||||
limitinum ++;
|
||||
}
|
||||
|
||||
if (!(AnimTab[num].flag & SMKANIM_LOOP) && !(AnimTab[num].flag & SMKANIM_BKG)) {
|
||||
if (_curAnimFrame[pos] >= SmkAnims[pos]->getFrameCount()) {
|
||||
StopSmackAnim(num);
|
||||
SemPaintHomo = 1;
|
||||
|
||||
_animMaxX = 0;
|
||||
_animMinX = MAXX;
|
||||
_animMaxY = 0;
|
||||
_animMinY = MAXY;
|
||||
} else
|
||||
CallSmackNextFrame();
|
||||
|
||||
} else
|
||||
CallSmackNextFrame();
|
||||
|
||||
if ((SmkAnims[pos] != NULL) && (_curAnimFrame[pos] >= SmkAnims[pos]->getFrameCount())) {
|
||||
if ((AnimTab[num].flag & SMKANIM_LOOP) || (AnimTab[num].flag & SMKANIM_BKG))
|
||||
InitAtFrameHandler(num, 0);
|
||||
|
||||
_curAnimFrame[pos] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------22/11/96 11.23-------------------
|
||||
Aggiorna Icona Smacker
|
||||
--------------------------------------------------*/
|
||||
void RegenSmackIcon(int StartIcon, int num) {
|
||||
int32 a;
|
||||
int pos, stx;
|
||||
|
||||
pos = MAXSMACK - 1;
|
||||
_curAnimFrame[pos] ++;
|
||||
|
||||
_curSmackBuffer = pos;
|
||||
|
||||
if (SmkAnims[_curSmackBuffer] == NULL)
|
||||
return;
|
||||
|
||||
stx = ICONMARGSX;
|
||||
for (a = 0; a < ICONSHOWN; a++) {
|
||||
if (_inventory[a + StartIcon] == (num - aiBANCONOTE + 1)) {
|
||||
stx = a * ICONDX + ICONMARGSX + CurScrollPageDx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (a == ICONSHOWN)
|
||||
return;
|
||||
|
||||
if (SmkAnims[pos]->hasDirtyPalette()) {
|
||||
for (a = 0; a < 256; a++)
|
||||
_smackPal[pos][a] = PalTo16bit(SmkAnims[pos]->getPalette()[a * 3 + 0], SmkAnims[pos]->getPalette()[a * 3 + 1], SmkAnims[pos]->getPalette()[a * 3 + 2]);
|
||||
}
|
||||
|
||||
//SmackDoFrame( SmkAnims[pos] );
|
||||
//SmackToBuffer( SmkAnims[pos], 0, 0,
|
||||
// SmkAnims[pos]->getWidth(), SmkAnims[pos]->getHeight(), SmackBuffer[pos], 0 );
|
||||
|
||||
//while ( SmackToBufferRect( SmkAnims[pos], SMACKSURFACESLOW ) )
|
||||
{
|
||||
for (a = 0; a < ICONDY - 0; a++) {
|
||||
byte2word(Video2 + 0 + stx + (0 + a + FIRSTLINE)*SCREENLEN,
|
||||
SmackBuffer[pos] + 0 + (0 + a)*SmkAnims[pos]->getWidth(),
|
||||
_smackPal[pos], SmkAnims[pos]->getWidth());
|
||||
|
||||
AddLine(0 + stx, 0 + SmkAnims[pos]->getWidth() + stx,
|
||||
0 + a + FIRSTLINE);
|
||||
}
|
||||
}
|
||||
|
||||
// for( a=0; a<ICONDY; a++ )
|
||||
// VCopy( stx+(FIRSTLINE+a)*SCREENLEN, Video2+stx+(FIRSTLINE+a)*SCREENLEN, SmkAnims[pos]->getWidth() );
|
||||
// UnlockVideo();
|
||||
|
||||
CallSmackNextFrame();
|
||||
}
|
||||
|
||||
int FullStart;
|
||||
int FullEnd;
|
||||
|
||||
/*-----------------07/02/97 16.53-------------------
|
||||
PlayFullMotion
|
||||
--------------------------------------------------*/
|
||||
void PlayFullMotion(int start, int end) {
|
||||
extern unsigned short _curDialog;
|
||||
|
||||
int pos = 1;
|
||||
_curSmackBuffer = pos;
|
||||
|
||||
if (start < 1)
|
||||
start = 1;
|
||||
if (end < 1)
|
||||
end = 1;
|
||||
|
||||
if (start > SmkAnims[pos]->getFrameCount()) {
|
||||
start = SmkAnims[pos]->getFrameCount() - 1;
|
||||
}
|
||||
if (end > SmkAnims[pos]->getFrameCount()) {
|
||||
end = SmkAnims[pos]->getFrameCount();
|
||||
}
|
||||
|
||||
// Se sono sue scelte attaccate
|
||||
if (_curAnimFrame[pos] != (start - 1)) {
|
||||
for (int a = 0; a < MAXNEWSMKPAL; a++) {
|
||||
if (((_dialog[_curDialog]._newPal[a] > start) || !(_dialog[_curDialog]._newPal[a])) && (a)) {
|
||||
SmkAnims[pos]->seekToFrame(_dialog[_curDialog]._newPal[a - 1]);
|
||||
for (a = 0; a < 256; a++) {
|
||||
_smackPal[pos][a] = PalTo16bit(SmkAnims[pos]->getPalette()[a * 3 + 0], SmkAnims[pos]->getPalette()[a * 3 + 1], SmkAnims[pos]->getPalette()[a * 3 + 2]);
|
||||
|
||||
_newData[a] = _smackPal[pos][a];
|
||||
_newData2[a] = (uint32)((uint32)_smackPal[pos][a] + (((uint32)_smackPal[pos][a]) << 16));
|
||||
}
|
||||
break;
|
||||
} else if ((_dialog[_curDialog]._newPal[a] == 0) || (_dialog[_curDialog]._newPal[a] == start))
|
||||
break;
|
||||
}
|
||||
|
||||
if ((end - start) > 2) {
|
||||
if (start > 10)
|
||||
SmkAnims[pos]->seekToFrame(start - 10);
|
||||
else
|
||||
SmkAnims[pos]->seekToFrame(1);
|
||||
|
||||
CallSmackSoundOnOff(pos, 1);
|
||||
CallSmackVolumePan(pos, 2, (32768 * 2 * SFxVol) / 125);
|
||||
CallSmackVolumePan(pos, 1, (32768 * 2 * SFxVol) / 125);
|
||||
if (SpeechON)
|
||||
CallSmackVolumePan(pos, 7, (32768 * 2 * SpeechVol) / 125);
|
||||
else
|
||||
CallSmackVolumePan(pos, 7, 0);
|
||||
|
||||
/*while ( SmkAnims[pos]->getCurFrame() < start - 1 )
|
||||
{
|
||||
SmackDoFrame( SmkAnims[pos] );
|
||||
SmackNextFrame( SmkAnims[pos] );
|
||||
while (SmackWait( SmkAnims[pos] ));
|
||||
}*/
|
||||
} else
|
||||
SmkAnims[pos]->seekToFrame(start);
|
||||
|
||||
_curAnimFrame[pos] = start - 1 ;
|
||||
} else {
|
||||
if ((end - start) > 2) {
|
||||
CallSmackSoundOnOff(pos, 1);
|
||||
CallSmackVolumePan(pos, 2, (32768 * 2 * SFxVol) / 125);
|
||||
CallSmackVolumePan(pos, 1, (32768 * 2 * SFxVol) / 125);
|
||||
if (SpeechON)
|
||||
CallSmackVolumePan(pos, 7, (32768 * 2 * SpeechVol) / 125);
|
||||
else
|
||||
CallSmackVolumePan(pos, 7, 0);
|
||||
}
|
||||
}
|
||||
|
||||
FullStart = start;
|
||||
FullEnd = end;
|
||||
|
||||
memset(&sdt, 0, sizeof(sdt));
|
||||
memset(&osdt, 0, sizeof(osdt));
|
||||
}
|
||||
|
||||
/*-----------------07/02/97 17.31-------------------
|
||||
BattutaPrint
|
||||
--------------------------------------------------*/
|
||||
void BattutaPrint(int x, int y, int c, const char *txt) {
|
||||
memcpy(&osdt, &sdt, sizeof(struct SDText));
|
||||
|
||||
sdt.sign = txt;
|
||||
sdt.x = x;
|
||||
sdt.y = y;
|
||||
sdt.tcol = c;
|
||||
}
|
||||
|
||||
/* -----------------29/07/97 22.09-------------------
|
||||
PaintSmackBuffer
|
||||
--------------------------------------------------*/
|
||||
void PaintSmackBuffer(int px, int py, int dx, int dy) {
|
||||
|
||||
int pos = 1;
|
||||
for (int a = 0; a < dy; a++) {
|
||||
if (SmkAnims[pos]->getHeight() > MAXY / 2) {
|
||||
if (SmkAnims[pos]->getWidth() > MAXX / 2)
|
||||
byte2word(Video2 + (a + py + TOP)*MAXX + px,
|
||||
SmackBuffer[pos] + (a + py)*SmkAnims[pos]->getWidth() + px, _newData, dx);
|
||||
else
|
||||
byte2long(Video2 + (a + py + TOP)*MAXX + px,
|
||||
SmackBuffer[pos] + (a + py)*SmkAnims[pos]->getWidth() + px / 2, _newData2, dx / 2);
|
||||
} else {
|
||||
if (SmkAnims[pos]->getWidth() > MAXX / 2)
|
||||
byte2word(Video2 + (a + py + TOP)*MAXX + px,
|
||||
SmackBuffer[pos] + ((a + py) / 2)*SmkAnims[pos]->getWidth() + px, _newData, dx);
|
||||
else
|
||||
byte2long(Video2 + (a + py + TOP)*MAXX + px,
|
||||
SmackBuffer[pos] + ((a + py) / 2)*SmkAnims[pos]->getWidth() + px / 2, _newData2, dx / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------22/11/96 11.23-------------------
|
||||
Aggiorna FullMotion
|
||||
--------------------------------------------------*/
|
||||
void RegenFullMotion() {
|
||||
extern uint16 CurDialog;
|
||||
int32 a, yfact;
|
||||
|
||||
int pos = 1;
|
||||
_curSmackBuffer = pos;
|
||||
|
||||
if (((_curAnimFrame[pos] + 1) >= FullStart) &&
|
||||
((_curAnimFrame[pos] + 1) <= FullEnd)) {
|
||||
_curAnimFrame[pos] ++;
|
||||
|
||||
if (SmkAnims[pos]->hasDirtyPalette()) {
|
||||
for (a = 0; a < 256; a++) {
|
||||
_smackPal[pos][a] = PalTo16bit(SmkAnims[pos]->getPalette()[a * 3 + 0], SmkAnims[pos]->getPalette()[a * 3 + 1], SmkAnims[pos]->getPalette()[a * 3 + 2]);
|
||||
|
||||
_newData[a] = _smackPal[pos][a];
|
||||
_newData2[a] = (uint32)((uint32)_smackPal[pos][a] + (((uint32)_smackPal[pos][a]) << 16));
|
||||
}
|
||||
}
|
||||
|
||||
DialogHandler(_curAnimFrame[pos]);
|
||||
|
||||
//SmackDoFrame( SmkAnims[pos] );
|
||||
//SmackToBuffer( SmkAnims[pos], 0, 0,
|
||||
// SmkAnims[pos]->getWidth(), SmkAnims[pos]->getHeight(), SmackBuffer[pos], 0 );
|
||||
|
||||
sdt.dx = TextLength(sdt.sign, 0);
|
||||
|
||||
sdt.x = 20;
|
||||
sdt.y = 380;
|
||||
sdt.dx = MAXX - 40;
|
||||
|
||||
sdt.dy = CheckDText(sdt);
|
||||
sdt.l[0] = 0;
|
||||
sdt.l[1] = 0;
|
||||
sdt.l[2] = MAXX;
|
||||
sdt.l[3] = MAXY;
|
||||
sdt.scol = MASKCOL;
|
||||
|
||||
// se c'era una scritta la cancella
|
||||
if (osdt.sign != NULL) {
|
||||
if ((osdt.y < sdt.y) || (osdt.y + osdt.dy > sdt.y + sdt.dy) || (sdt.sign == NULL)) {
|
||||
PaintSmackBuffer(0, osdt.y - TOP, MAXX, osdt.dy);
|
||||
ShowScreen(0, osdt.y, MAXX, osdt.dy);
|
||||
}
|
||||
osdt.sign = NULL;
|
||||
}
|
||||
// se c'e' una scritta
|
||||
if (sdt.sign != NULL) {
|
||||
PaintSmackBuffer(0, sdt.y - TOP, MAXX, sdt.dy);
|
||||
// scrive stringa
|
||||
if (TextON)
|
||||
DText(sdt);
|
||||
// e la fa vedere
|
||||
//ShowScreen( 0, sdt._y, MAXX, sdt._dy );
|
||||
osdt.sign = NULL;
|
||||
}
|
||||
|
||||
if (SmkAnims[pos]->getHeight() > MAXY / 2)
|
||||
yfact = 1;
|
||||
else
|
||||
yfact = 2;
|
||||
|
||||
//while ( SmackToBufferRect( SmkAnims[pos], SMACKSURFACESLOW ) )
|
||||
{
|
||||
for (a = 0; a < SmkAnims[pos]->getHeight(); a++) {
|
||||
// se non ho gia' copiato la scritta
|
||||
if ((sdt.sign == NULL) ||
|
||||
((0 + a)*yfact < (sdt.y - TOP)) ||
|
||||
((0 + a)*yfact >= (sdt.y + sdt.dy - TOP))) {
|
||||
// sceglie se raddoppiare o no
|
||||
// in altezza
|
||||
if (SmkAnims[pos]->getHeight() > MAXY / 2) {
|
||||
// in larghezza
|
||||
if (SmkAnims[pos]->getWidth() > MAXX / 2) {
|
||||
BCopy(0 + (0 + a)*MAXX + ((MAXY - SmkAnims[pos]->getHeight()) / 2)*MAXX,
|
||||
SmackBuffer[pos] + 0 + (0 + a)*SmkAnims[pos]->getWidth(),
|
||||
SmkAnims[pos]->getWidth());
|
||||
} else {
|
||||
DCopy(0 * 2 + (0 + a)*MAXX + ((MAXY - SmkAnims[pos]->getHeight()) / 2)*MAXX,
|
||||
SmackBuffer[pos] + 0 + (0 + a)*SmkAnims[pos]->getWidth(),
|
||||
SmkAnims[pos]->getWidth());
|
||||
}
|
||||
} else {
|
||||
if (SmkAnims[pos]->getWidth() > MAXX / 2) {
|
||||
BCopy(0 + ((0 + a) * 2)*MAXX + ((MAXY - SmkAnims[pos]->getHeight() * 2) / 2)*MAXX,
|
||||
SmackBuffer[pos] + 0 + (0 + a)*SmkAnims[pos]->getWidth(),
|
||||
SmkAnims[pos]->getWidth());
|
||||
BCopy(0 + ((0 + a) * 2 + 1)*MAXX + ((MAXY - SmkAnims[pos]->getHeight() * 2) / 2)*MAXX,
|
||||
SmackBuffer[pos] + 0 + (0 + a)*SmkAnims[pos]->getWidth(),
|
||||
SmkAnims[pos]->getWidth());
|
||||
} else {
|
||||
DCopy(0 * 2 + ((0 + a) * 2)*MAXX + ((MAXY - SmkAnims[pos]->getHeight() * 2) / 2)*MAXX,
|
||||
SmackBuffer[pos] + 0 + (0 + a)*SmkAnims[pos]->getWidth(),
|
||||
SmkAnims[pos]->getWidth());
|
||||
DCopy(0 * 2 + ((0 + a) * 2 + 1)*MAXX + ((MAXY - SmkAnims[pos]->getHeight() * 2) / 2)*MAXX,
|
||||
SmackBuffer[pos] + 0 + (0 + a)*SmkAnims[pos]->getWidth(),
|
||||
SmkAnims[pos]->getWidth());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sdt.sign != NULL)
|
||||
ShowScreen(0, sdt.y, MAXX, sdt.dy);
|
||||
UnlockVideo();
|
||||
|
||||
if (_curAnimFrame[pos] == FullEnd) {
|
||||
PaintSmackBuffer(0, 0, MAXX, AREA);
|
||||
doEvent(MC_DIALOG, ME_ENDSCELTA, MP_HIGH, _curAnimFrame[pos], 0, 0, 0);
|
||||
CallSmackSoundOnOff(pos, 0);
|
||||
} else {
|
||||
CallSmackNextFrame();
|
||||
|
||||
if (_curAnimFrame[pos] >= SmkAnims[pos]->getFrameCount())
|
||||
StopFullMotion();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
420
engines/trecision/nl/sys/ffile.cpp
Normal file
420
engines/trecision/nl/sys/ffile.cpp
Normal file
@ -0,0 +1,420 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#include <search.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void warning(const char *format, ...);
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
typedef struct {
|
||||
char name[12];
|
||||
int offset;
|
||||
} FILEENTRY, *LPFILEENTRY;
|
||||
|
||||
typedef struct SFileHandle {
|
||||
char inuse;
|
||||
int pos;
|
||||
int size;
|
||||
LPFILEENTRY pfe;
|
||||
} FILEHANDLE, *LPFILEHANDLE;
|
||||
|
||||
#define MAXFHANDLE 10
|
||||
#define MAXFILES 500
|
||||
int Compare(const void *p1, const void *p2);
|
||||
|
||||
static FILE *hFile;
|
||||
static FILEENTRY pFE[MAXFILES];
|
||||
static char *pBase;
|
||||
static int dwFECnt;
|
||||
static FILEHANDLE lpFH[MAXFHANDLE];
|
||||
static int dwFHCnt;
|
||||
static int lFileEnd;
|
||||
|
||||
extern const char *_sysSent[];
|
||||
void CheckFileInCD(const char *name);
|
||||
void CloseSys(const char *str);
|
||||
void FastFileFinish();
|
||||
void AnimFileFinish();
|
||||
void SpeechFileFinish();
|
||||
|
||||
/* -----------------19/01/98 17.12-------------------
|
||||
* Compare
|
||||
*
|
||||
* bsearch comparison routine
|
||||
* --------------------------------------------------*/
|
||||
int Compare(const void *p1, const void *p2) {
|
||||
LPFILEENTRY p1c = (LPFILEENTRY)p1, p2c = (LPFILEENTRY)p2;
|
||||
|
||||
return (stricmp((p1c)->name, (p2c)->name));
|
||||
}
|
||||
|
||||
/* -----------------19/01/98 17.13-------------------
|
||||
* FastFileInit
|
||||
*
|
||||
* Initialize for fast file access. The master file and maximum number
|
||||
* of open "files" are specified.
|
||||
* --------------------------------------------------*/
|
||||
char FastFileInit(const char *fname) {
|
||||
FastFileFinish();
|
||||
|
||||
// get a file handle array - just do it
|
||||
dwFHCnt = MAXFHANDLE - 1;
|
||||
|
||||
hFile = fopen(fname, "rb");
|
||||
|
||||
if (hFile == NULL) {
|
||||
warning("FastFileInit: CreateFile open error %s", fname);
|
||||
hFile = NULL;
|
||||
FastFileFinish();
|
||||
CloseSys(_sysSent[1]);
|
||||
return false;
|
||||
}
|
||||
|
||||
// get initial data from the memory mapped file
|
||||
fread(&dwFECnt, 4, 1, hFile);
|
||||
fread(pFE, sizeof(FILEENTRY), dwFECnt, hFile);
|
||||
lFileEnd = pFE[dwFECnt - 1].offset;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/* -----------------19/01/98 17.14-------------------
|
||||
* FastFileFinish
|
||||
*
|
||||
* Clean up resources
|
||||
* --------------------------------------------------*/
|
||||
void FastFileFinish(void) {
|
||||
if (hFile != NULL) {
|
||||
fclose(hFile);
|
||||
hFile = NULL;
|
||||
}
|
||||
dwFHCnt = 0;
|
||||
pBase = NULL;
|
||||
dwFECnt = 0;
|
||||
|
||||
}
|
||||
|
||||
/* -----------------19/01/98 17.15-------------------
|
||||
* FastFileOpen
|
||||
*
|
||||
* Search the directory for the file, and return a file handle if found.
|
||||
* --------------------------------------------------*/
|
||||
LPFILEHANDLE FastFileOpen(const char *name) {
|
||||
FILEENTRY fe;
|
||||
LPFILEENTRY pfe;
|
||||
|
||||
if (pFE == NULL) {
|
||||
warning("FastFileOpen: not initialized");
|
||||
return NULL;
|
||||
}
|
||||
if (name == NULL || name[0] == 0) {
|
||||
warning("FastFileOpen: invalid name");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strcpy(fe.name, name);
|
||||
pfe = (LPFILEENTRY)bsearch(&fe, pFE, dwFECnt, sizeof(FILEENTRY), Compare);
|
||||
if (pfe == NULL) {
|
||||
CheckFileInCD(name);
|
||||
pfe = (LPFILEENTRY)bsearch(&fe, pFE, dwFECnt, sizeof(FILEENTRY), Compare);
|
||||
}
|
||||
if (pfe != NULL) {
|
||||
for (int i = 0; i < dwFHCnt; i++) {
|
||||
if (!lpFH[i].inuse) {
|
||||
lpFH[i].inuse = true;
|
||||
lpFH[i].pos = pfe->offset;
|
||||
lpFH[i].size = (pfe + 1)->offset - pfe->offset;
|
||||
lpFH[i].pfe = pfe;
|
||||
fseek(hFile, lpFH[i].pos, SEEK_SET);
|
||||
return &lpFH[i];
|
||||
}
|
||||
}
|
||||
warning("FastFileOpen: Out of file handles");
|
||||
} else {
|
||||
warning("FastFileOpen: File %s not found", name);
|
||||
CloseSys(_sysSent[1]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
/* -----------------19/01/98 17.16-------------------
|
||||
* FastFileClose
|
||||
*
|
||||
* Mark a fast file handle as closed
|
||||
* --------------------------------------------------*/
|
||||
char FastFileClose(LPFILEHANDLE pfh) {
|
||||
if (pfh == NULL || pfh->inuse != true) {
|
||||
warning("FastFileClose: invalid handle");
|
||||
return false;
|
||||
}
|
||||
pfh->inuse = false;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/* -----------------19/01/98 17.17-------------------
|
||||
* FastFileRead
|
||||
*
|
||||
* read from a fast file (memcpy!)
|
||||
* --------------------------------------------------*/
|
||||
int FastFileRead(LPFILEHANDLE pfh, void *ptr, int size) {
|
||||
if (pfh == NULL || pfh->inuse != true) {
|
||||
warning("FastFileRead: invalid handle");
|
||||
return false;
|
||||
}
|
||||
if (size < 0) {
|
||||
warning("FastFileRead: invalid size");
|
||||
return false;
|
||||
}
|
||||
if ((pfh->pos + size) > ((pfh->pfe) + 1)->offset) {
|
||||
warning("FastFileRead: read past end of file");
|
||||
return false;
|
||||
}
|
||||
fread(ptr, 1, size, hFile);
|
||||
pfh->pos += size;
|
||||
return size;
|
||||
|
||||
}
|
||||
|
||||
/* -----------------19/01/98 17.17-------------------
|
||||
* FastFileLen
|
||||
*
|
||||
* Get the current length in a fast file
|
||||
* --------------------------------------------------*/
|
||||
int FastFileLen(LPFILEHANDLE pfh) {
|
||||
LPFILEENTRY pfe;
|
||||
|
||||
if (pfh == NULL || pfh->inuse != true) {
|
||||
warning("FastFileTell: invalid handle");
|
||||
return -1;
|
||||
}
|
||||
pfe = pfh->pfe;
|
||||
return (pfe + 1)->offset - pfe->offset;
|
||||
|
||||
}
|
||||
|
||||
// BigFile
|
||||
#define MAXSMACK 3
|
||||
extern unsigned char _curSmackBuffer;
|
||||
FILE *aFile[MAXSMACK] = {NULL, NULL, NULL}, *FmvFile = NULL;
|
||||
FILEENTRY AFE[1000];
|
||||
int AFNum;
|
||||
|
||||
/* -----------------26/01/98 16.53-------------------
|
||||
* ACompare
|
||||
* --------------------------------------------------*/
|
||||
int ACompare(const void *p1, const void *p2) {
|
||||
LPFILEENTRY p1c = (LPFILEENTRY)p1, p2c = (LPFILEENTRY)p2;
|
||||
return (stricmp((p1c)->name, (p2c)->name));
|
||||
}
|
||||
|
||||
/* -----------------19/01/98 17.13-------------------
|
||||
* AnimFileInit
|
||||
* --------------------------------------------------*/
|
||||
char AnimFileInit(const char *fname) {
|
||||
AnimFileFinish();
|
||||
|
||||
for (int a = 0; a < MAXSMACK; a++) {
|
||||
aFile[a] = fopen(fname, "rb");
|
||||
|
||||
if (aFile[a] == NULL) {
|
||||
warning("AnimFileInit: CreateFile open error %s", fname);
|
||||
aFile[a] = NULL;
|
||||
AnimFileFinish();
|
||||
CloseSys(_sysSent[1]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
fread(&AFNum, 4, 1, aFile[0]);
|
||||
fread(AFE, sizeof(FILEENTRY), AFNum, aFile[0]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* -----------------19/01/98 17.14-------------------
|
||||
* AnimFileFinish
|
||||
* --------------------------------------------------*/
|
||||
void AnimFileFinish(void) {
|
||||
for (int a = 0; a < MAXSMACK; a++) {
|
||||
if (aFile[a] != NULL) {
|
||||
fclose(aFile[a]);
|
||||
aFile[a] = NULL;
|
||||
}
|
||||
}
|
||||
AFNum = 0;
|
||||
}
|
||||
|
||||
/* -----------------19/01/98 17.15-------------------
|
||||
* AnimFileOpen
|
||||
* --------------------------------------------------*/
|
||||
int AnimFileOpen(const char *name) {
|
||||
FILEENTRY fe;
|
||||
LPFILEENTRY pfe;
|
||||
|
||||
if (name == NULL || name[0] == 0) {
|
||||
warning("AnimFileOpen: invalid name");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strcpy(fe.name, name);
|
||||
pfe = (LPFILEENTRY)bsearch(&fe, AFE, AFNum, sizeof(FILEENTRY), ACompare);
|
||||
if (pfe == NULL) {
|
||||
CheckFileInCD(name);
|
||||
pfe = (LPFILEENTRY)bsearch(&fe, AFE, AFNum, sizeof(FILEENTRY), ACompare);
|
||||
}
|
||||
|
||||
if (pfe != NULL) {
|
||||
fseek(aFile[_curSmackBuffer], pfe->offset, SEEK_SET);
|
||||
return (int)aFile[_curSmackBuffer];
|
||||
}
|
||||
|
||||
warning("AnimFileOpen: File %s not found", name);
|
||||
CloseSys(_sysSent[1]);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* -----------------19/01/98 17.15-------------------
|
||||
* FmvFileOpen
|
||||
* --------------------------------------------------*/
|
||||
int FmvFileOpen(const char *name) {
|
||||
extern char UStr[];
|
||||
extern char GamePath[];
|
||||
|
||||
if (FmvFile != NULL) fclose(FmvFile);
|
||||
FmvFile = NULL;
|
||||
|
||||
if (name == NULL || name[0] == 0) {
|
||||
warning("FmvFileOpen: invalid name");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sprintf(UStr, "%sFMV\\%s", GamePath, name);
|
||||
FmvFile = fopen(UStr, "rb");
|
||||
if (FmvFile != NULL)
|
||||
return (int)FmvFile;
|
||||
|
||||
warning("Fmv file %s not found!", name);
|
||||
CloseSys(_sysSent[1]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// SpeechFile
|
||||
FILE *sFile = NULL;
|
||||
FILEENTRY SFE[2000];
|
||||
int SFNum;
|
||||
|
||||
/* -----------------04/08/98 11.33-------------------
|
||||
* SpeechFileInit
|
||||
* --------------------------------------------------*/
|
||||
char SpeechFileInit(const char *fname) {
|
||||
SpeechFileFinish();
|
||||
|
||||
sFile = fopen(fname, "rb");
|
||||
|
||||
if (sFile == NULL) {
|
||||
warning("SpeechFileInit: CreateFile open error %s", fname);
|
||||
sFile = NULL;
|
||||
SpeechFileFinish();
|
||||
CloseSys(_sysSent[1]);
|
||||
return false;
|
||||
}
|
||||
|
||||
fread(&SFNum, 4, 1, sFile);
|
||||
fread(SFE, sizeof(FILEENTRY), SFNum, sFile);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* -----------------04/08/98 11.33-------------------
|
||||
* SpeechFileFinish
|
||||
* --------------------------------------------------*/
|
||||
void SpeechFileFinish(void) {
|
||||
if (sFile != NULL) {
|
||||
fclose(sFile);
|
||||
sFile = NULL;
|
||||
}
|
||||
SFNum = 0;
|
||||
}
|
||||
|
||||
/* -----------------04/08/98 11.34-------------------
|
||||
* SpeechFileLen
|
||||
* --------------------------------------------------*/
|
||||
int SpeechFileLen(const char *name) {
|
||||
FILEENTRY fe;
|
||||
LPFILEENTRY pfe;
|
||||
|
||||
if (name == NULL || name[0] == 0) {
|
||||
warning("SpeechFileOpen: invalid name");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strcpy(fe.name, name);
|
||||
pfe = (LPFILEENTRY)bsearch(&fe, SFE, SFNum, sizeof(FILEENTRY), ACompare);
|
||||
if (pfe != NULL)
|
||||
return ((pfe + 1)->offset - pfe->offset);
|
||||
|
||||
warning("SpeechFileOpen: File %s not found", name);
|
||||
CloseSys(_sysSent[1]);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* -----------------04/08/98 11.12-------------------
|
||||
* SpeechFileRead
|
||||
* --------------------------------------------------*/
|
||||
int SpeechFileRead(const char *name, unsigned char *buf) {
|
||||
FILEENTRY fe;
|
||||
LPFILEENTRY pfe;
|
||||
|
||||
if (name == NULL || name[0] == 0 || buf == NULL) {
|
||||
warning("SpeechFileOpen: invalid name");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strcpy(fe.name, name);
|
||||
pfe = (LPFILEENTRY)bsearch(&fe, SFE, SFNum, sizeof(FILEENTRY), ACompare);
|
||||
if (pfe == NULL) {
|
||||
CheckFileInCD(name);
|
||||
pfe = (LPFILEENTRY)bsearch(&fe, SFE, SFNum, sizeof(FILEENTRY), ACompare);
|
||||
}
|
||||
|
||||
if (pfe != NULL) {
|
||||
fseek(sFile, pfe->offset, SEEK_SET);
|
||||
return fread(buf, 1, ((pfe + 1)->offset - pfe->offset), sFile);
|
||||
}
|
||||
|
||||
warning("SpeechFileOpen: File %s not found", name);
|
||||
CloseSys(_sysSent[1]);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
477
engines/trecision/nl/sys/main.cpp
Normal file
477
engines/trecision/nl/sys/main.cpp
Normal file
@ -0,0 +1,477 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "trecision/nl/lib/addtype.h"
|
||||
#include "trecision/nl/sysdef.h"
|
||||
#include "trecision/nl/define.h"
|
||||
|
||||
#include "common/config-manager.h"
|
||||
#include "common/events.h"
|
||||
#include "common/system.h"
|
||||
#include "engines/engine.h"
|
||||
#include "graphics/colormasks.h"
|
||||
#include "graphics/pixelformat.h"
|
||||
#include "graphics/surface.h"
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
int CurKey, CurAscii;
|
||||
short wmx = 0, wmy = 0, wmleft = 0, wmright = 0, omx = 0, omy = 0;
|
||||
int VideoLocked = 0;
|
||||
Graphics::PixelFormat ScreenFormat;
|
||||
bool _linearMode, _gamePaused = false;
|
||||
|
||||
extern short mx, my, mleft, mright;
|
||||
extern uint16 *Video, VideoPitch;
|
||||
extern int8 MouseONOFF;
|
||||
extern FILE *fhi;
|
||||
extern uint8 *SoundStartBuffer;
|
||||
extern uint8 *MemoryArea;
|
||||
extern const char *_sysSent[];
|
||||
extern int ForceQuit;
|
||||
extern int RoomReady;
|
||||
extern int KeybInput;
|
||||
|
||||
void initMain();
|
||||
void NextMessage();
|
||||
void longset(void *dest, uint32 value, uint32 len);
|
||||
void MCopy(unsigned short *Dest, unsigned short *Src, unsigned int Len);
|
||||
void StopAllSmackAnims();
|
||||
void StopSoundSystem();
|
||||
void RefreshAllAnimations();
|
||||
void FastFileFinish();
|
||||
void AnimFileFinish();
|
||||
void SpeechFileFinish();
|
||||
void DisableAutorun();
|
||||
void RestoreAutorun();
|
||||
void VMouseON();
|
||||
void VMouseOFF();
|
||||
void ClearScreen();
|
||||
void UnacquireDIG(short wParam);
|
||||
void ReacquireDIG();
|
||||
void UnlockVideo();
|
||||
char waitKey();
|
||||
void ShowScreen(int px, int py, int dx, int dy);
|
||||
void wordset(void *dest, uint16 value, uint32 len);
|
||||
|
||||
void GetColorMask(const Graphics::PixelFormat &format) {
|
||||
extern unsigned short _bitMask[3];
|
||||
|
||||
_bitMask[0] = format.rMax() << format.rShift;
|
||||
_bitMask[1] = format.gMax() << format.gShift;
|
||||
_bitMask[2] = format.bMax() << format.bShift;
|
||||
}
|
||||
|
||||
void SetCapsLock(bool bState) {
|
||||
/*
|
||||
extern int FastWalk,FastWalkLocked;
|
||||
BYTE keyState[256];
|
||||
|
||||
GetKeyboardState((LPBYTE)&keyState);
|
||||
if( (bState && !(keyState[VK_CAPITAL] & 1)) || (!bState && (keyState[VK_CAPITAL] & 1)) )
|
||||
{
|
||||
// Simulate a key press
|
||||
keybd_event( VK_CAPITAL, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0 );
|
||||
|
||||
// Simulate a key release
|
||||
keybd_event( VK_CAPITAL, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
|
||||
|
||||
FastWalk = true;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
int GetCapsLock() {
|
||||
/*
|
||||
BYTE keyState[256];
|
||||
|
||||
GetKeyboardState((LPBYTE)&keyState);
|
||||
if( keyState[VK_CAPITAL] & 1 )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
void EventLoop() {
|
||||
extern int FastWalk, FastWalkLocked;
|
||||
Common::Event event;
|
||||
while (g_system->getEventManager()->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case Common::EVENT_MOUSEMOVE:
|
||||
wmx = event.mouse.x;
|
||||
wmy = event.mouse.y;
|
||||
break;
|
||||
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
wmleft = 1;
|
||||
FastWalk = GetCapsLock();
|
||||
break;
|
||||
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
wmleft = 0;
|
||||
break;
|
||||
|
||||
case Common::EVENT_RBUTTONDOWN:
|
||||
wmright = 1;
|
||||
FastWalk = GetCapsLock();
|
||||
break;
|
||||
|
||||
case Common::EVENT_RBUTTONUP:
|
||||
wmright = 0;
|
||||
break;
|
||||
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (event.kbd.keycode == Common::KEYCODE_CAPSLOCK) {
|
||||
if (!FastWalkLocked)
|
||||
FastWalk ^= true;
|
||||
FastWalkLocked = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case Common::EVENT_KEYUP:
|
||||
CurKey = event.kbd.keycode;
|
||||
CurAscii = event.kbd.ascii;
|
||||
switch (event.kbd.keycode) {
|
||||
case Common::KEYCODE_p:
|
||||
if (!_gamePaused && !KeybInput) {
|
||||
CurKey = 0;
|
||||
_gamePaused = true;
|
||||
waitKey();
|
||||
}
|
||||
_gamePaused = false;
|
||||
break;
|
||||
|
||||
case Common::KEYCODE_CAPSLOCK:
|
||||
FastWalkLocked = false;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
//g_system->delayMillis(10);
|
||||
g_system->updateScreen();
|
||||
}
|
||||
|
||||
void NlInit() {
|
||||
extern char GamePath[];
|
||||
strcpy(GamePath, ConfMan.get("path").c_str());
|
||||
|
||||
ClearScreen();
|
||||
|
||||
ScreenFormat = g_system->getScreenFormat();
|
||||
GetColorMask(ScreenFormat);
|
||||
|
||||
_linearMode = true;
|
||||
initMain();
|
||||
|
||||
SetCapsLock(false);
|
||||
|
||||
while (!g_engine->shouldQuit()) {
|
||||
EventLoop();
|
||||
NextMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------25/10/97 15.12-------------------
|
||||
CheckSystem
|
||||
--------------------------------------------------*/
|
||||
void CheckSystem() {
|
||||
//for ( int a=0; a<5; a++ )
|
||||
{
|
||||
RefreshAllAnimations();
|
||||
EventLoop();
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------16/01/97 16.21-------------------
|
||||
LockVideo
|
||||
--------------------------------------------------*/
|
||||
void LockVideo() {
|
||||
if (!VideoLocked) {
|
||||
Graphics::Surface *surface = g_system->lockScreen();
|
||||
Video = (uint16 *)surface->getPixels();
|
||||
VideoPitch = surface->pitch;
|
||||
|
||||
VideoLocked = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------16/01/97 16.21-------------------
|
||||
UnlockVideo
|
||||
--------------------------------------------------*/
|
||||
void UnlockVideo() {
|
||||
if (VideoLocked) {
|
||||
g_system->unlockScreen();
|
||||
VideoLocked = 0;
|
||||
VideoPitch = 0;
|
||||
Video = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------16/01/97 20.53-------------------
|
||||
GetKey
|
||||
--------------------------------------------------*/
|
||||
char GetKey() {
|
||||
int key = CurKey;
|
||||
int ascii = CurAscii;
|
||||
CurKey = 0;
|
||||
CurAscii = 0;
|
||||
|
||||
switch (key) {
|
||||
case Common::KEYCODE_SPACE:
|
||||
case Common::KEYCODE_ESCAPE:
|
||||
case Common::KEYCODE_RETURN:
|
||||
case Common::KEYCODE_CLEAR:
|
||||
case Common::KEYCODE_BACKSPACE:
|
||||
return key;
|
||||
case Common::KEYCODE_F1:
|
||||
case Common::KEYCODE_F2:
|
||||
case Common::KEYCODE_F3:
|
||||
case Common::KEYCODE_F4:
|
||||
case Common::KEYCODE_F5:
|
||||
case Common::KEYCODE_F6:
|
||||
return 0x3B + key - Common::KEYCODE_F1;
|
||||
default:
|
||||
if (ascii) {
|
||||
return ascii;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------17/01/97 11.17-------------------
|
||||
waitKey
|
||||
--------------------------------------------------*/
|
||||
char waitKey() {
|
||||
while (CurKey == 0)
|
||||
CheckSystem();
|
||||
|
||||
int t = CurKey;
|
||||
CurKey = 0;
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
/*-----------------17/01/97 11.18-------------------
|
||||
FreeKey
|
||||
--------------------------------------------------*/
|
||||
void FreeKey() {
|
||||
CurKey = 0;
|
||||
}
|
||||
|
||||
/*-----------------10/12/95 15.52-------------------
|
||||
ClearScreen
|
||||
--------------------------------------------------*/
|
||||
void ClearScreen() {
|
||||
LockVideo();
|
||||
if (Video == NULL)
|
||||
return ;
|
||||
if ((VideoPitch == 0) || (VideoPitch == SCREENLEN * 2))
|
||||
longset(Video, 0x00000000, 320 * 480);
|
||||
else
|
||||
longset(Video, 0x00000000, (VideoPitch / 4) * 480);
|
||||
UnlockVideo();
|
||||
}
|
||||
|
||||
/*-----------------10/12/95 15.52-------------------
|
||||
ReadTime
|
||||
--------------------------------------------------*/
|
||||
uint32 ReadTime() {
|
||||
return ((g_system->getMillis() * 3) / 50);
|
||||
}
|
||||
|
||||
/* -----------------26/01/98 10.26-------------------
|
||||
* NlDelay
|
||||
* --------------------------------------------------*/
|
||||
void NlDelay(uint32 val) {
|
||||
uint32 sv = ReadTime();
|
||||
|
||||
while ((sv + val) > ReadTime())
|
||||
CheckSystem();
|
||||
}
|
||||
|
||||
/* -----------------24/06/98 15.00-------------------
|
||||
* NlDissolve
|
||||
* --------------------------------------------------*/
|
||||
void NlDissolve(int val) {
|
||||
extern uint16 *Video2;
|
||||
uint16 CenterX = MAXX / 2, CenterY = MAXY / 2;
|
||||
int sv = ReadTime(), cv;
|
||||
|
||||
int lastv = 9000;
|
||||
while ((sv + val) > (cv = ReadTime())) {
|
||||
CheckSystem();
|
||||
if (lastv < (sv + val - cv))
|
||||
continue;
|
||||
|
||||
lastv = (sv + val - cv);
|
||||
|
||||
float a = (float)(((CenterX + 200) / val) * lastv);
|
||||
float b = (float)((CenterY / val) * lastv);
|
||||
|
||||
float x = 0.0f;
|
||||
float y = b;
|
||||
|
||||
if ((CenterY - (int)y) > TOP)
|
||||
wordset(Video2 + (TOP)*MAXX, 0, ((CenterY - (int)y) - TOP)*MAXX);
|
||||
if ((AREA + TOP) > (CenterY + (int)y))
|
||||
wordset(Video2 + (CenterY + (int)y)*MAXX, 0, (AREA + TOP - (CenterY + (int)y))*MAXX);
|
||||
|
||||
float d1 = b * b - a * a * b + a * a / 4.0f;
|
||||
while (a * a * (y - 0.5f) > b * b * (x + 1.0f)) {
|
||||
if (d1 < 0.0f)
|
||||
d1 += b * b * (2.0f * x + 3.0f);
|
||||
else {
|
||||
d1 += b * b * (2.0f * x + 3.0f) + a * a * (-2.0f * y + 2.0f);
|
||||
y -= 1.0f;
|
||||
}
|
||||
x += 1.0f;
|
||||
|
||||
if ((CenterX + (int)x) < MAXX)
|
||||
wordset(Video2 + CenterX + (int)x + (CenterY + (int)y)*MAXX, 0, MAXX - (CenterX + (int)x));
|
||||
if ((CenterX + (int)x) < MAXX)
|
||||
wordset(Video2 + CenterX + (int)x + (CenterY - (int)y)*MAXX, 0, MAXX - (CenterX + (int)x));
|
||||
if ((CenterX - (int)x) > 0)
|
||||
wordset(Video2 + (CenterY + (int)y)*MAXX, 0, (CenterX - (int)x));
|
||||
if ((CenterX - (int)x) > 0)
|
||||
wordset(Video2 + (CenterY - (int)y)*MAXX, 0, (CenterX - (int)x));
|
||||
}
|
||||
|
||||
float d2 = b * b * (x + 0.5f) * (x + 0.5f) + a * a * (y - 1.0f) * (y - 1.0f) - a * a * b * b;
|
||||
while (y > 0.0f) {
|
||||
if (d2 < 0.0f) {
|
||||
d2 += b * b * (2.0f * x + 2.0f) + a * a * (-2.0f * y + 3.0f);
|
||||
x += 1.0f;
|
||||
} else
|
||||
d2 += a * a * (-2.0f * y + 3.0f);
|
||||
y -= 1.0f;
|
||||
|
||||
if ((CenterX + (int)x) < MAXX)
|
||||
wordset(Video2 + CenterX + (int)x + (CenterY + (int)y)*MAXX, 0, MAXX - (CenterX + (int)x));
|
||||
if ((CenterX + (int)x) < MAXX)
|
||||
wordset(Video2 + CenterX + (int)x + (CenterY - (int)y)*MAXX, 0, MAXX - (CenterX + (int)x));
|
||||
if ((CenterX - (int)x) > 0)
|
||||
wordset(Video2 + (CenterY + (int)y)*MAXX, 0, (CenterX - (int)x));
|
||||
if ((CenterX - (int)x) > 0)
|
||||
wordset(Video2 + (CenterY - (int)y)*MAXX, 0, (CenterX - (int)x));
|
||||
}
|
||||
|
||||
|
||||
ShowScreen(0, 0, MAXX, MAXY);
|
||||
}
|
||||
|
||||
ClearScreen();
|
||||
}
|
||||
|
||||
/*-----------------10/12/95 15.25-------------------
|
||||
click_handler
|
||||
--------------------------------------------------*/
|
||||
|
||||
/*-----------------10/12/95 15.29-------------------
|
||||
Mouse
|
||||
--------------------------------------------------*/
|
||||
void Mouse(uint8 opt) {
|
||||
extern short SemMouseEnabled;
|
||||
|
||||
CheckSystem();
|
||||
|
||||
switch (opt) {
|
||||
// Update mouse
|
||||
case 3: {
|
||||
if ((MouseONOFF) && !(SemMouseEnabled))
|
||||
Mouse(2);
|
||||
|
||||
if (!(MouseONOFF) && (SemMouseEnabled))
|
||||
Mouse(1);
|
||||
|
||||
if (MouseONOFF) {
|
||||
mx = wmx & 0xFFFF;
|
||||
my = wmy & 0xFFFF;
|
||||
mleft = wmleft & 0xFFFF;
|
||||
mright = wmright & 0xFFFF;
|
||||
|
||||
mx = CLIP<int16>(mx, 10, MAXX - 11);
|
||||
my = CLIP<int16>(my, 10, MAXY - 11);
|
||||
|
||||
VMouseON();
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Turn off mouse
|
||||
case 2: {
|
||||
if (!MouseONOFF)
|
||||
break;
|
||||
MouseONOFF = 0;
|
||||
VMouseOFF();
|
||||
break;
|
||||
}
|
||||
// Turn on mouse
|
||||
case 1: {
|
||||
if (MouseONOFF)
|
||||
break;
|
||||
MouseONOFF = 1;
|
||||
mx = wmx & 0xFFFF;
|
||||
my = wmy & 0xFFFF;
|
||||
mleft = wmleft & 0xFFFF;
|
||||
mright = wmright & 0xFFFF;
|
||||
|
||||
mx = CLIP<int16>(mx, 10, MAXX - 11);
|
||||
my = CLIP<int16>(my, 10, MAXY - 11);
|
||||
|
||||
VMouseON();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------17/02/95 10.18-------------------
|
||||
CloseSys
|
||||
--------------------------------------------------*/
|
||||
void CloseSys(const char *str) { // close all
|
||||
if (MemoryArea)
|
||||
free(MemoryArea);
|
||||
|
||||
FastFileFinish();
|
||||
SpeechFileFinish();
|
||||
AnimFileFinish();
|
||||
StopAllSmackAnims();
|
||||
StopSoundSystem();
|
||||
|
||||
if (fhi)
|
||||
fclose(fhi);
|
||||
|
||||
if (str)
|
||||
warning(str);
|
||||
|
||||
g_system->quit();
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
445
engines/trecision/nl/sys/sound.cpp
Normal file
445
engines/trecision/nl/sys/sound.cpp
Normal file
@ -0,0 +1,445 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
//#include <i86.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "trecision/nl/lib/addtype.h"
|
||||
#include "trecision/nl/sysdef.h"
|
||||
#include "trecision/nl/define.h"
|
||||
|
||||
#include "audio/mixer.h"
|
||||
#include "common/memstream.h"
|
||||
#include "common/system.h"
|
||||
#include "audio/decoders/wave.h"
|
||||
#include "audio/audiostream.h"
|
||||
|
||||
#define SOUND_OFF 0
|
||||
#define SOUND_ON 1
|
||||
|
||||
#define SFADIN 1
|
||||
#define SFADOUT 2
|
||||
|
||||
#define SAMPLEVOICES 6
|
||||
#define NUMSAMPLES MAXSAMPLE
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
struct SNLSample {
|
||||
Audio::SeekableAudioStream *stream;
|
||||
Audio::Mixer::SoundType type;
|
||||
} NLSample[NUMSAMPLES];
|
||||
SNLSample SpeechSample;
|
||||
|
||||
struct SSound {
|
||||
char name[14];
|
||||
uint8 volume;
|
||||
uint8 flag;
|
||||
int8 panning;
|
||||
};
|
||||
extern SSound GSample[];
|
||||
|
||||
int SoundDevice = -1;
|
||||
int BackSound = 1;
|
||||
|
||||
Audio::SoundHandle smp[SAMPLEVOICES]; // Sample handles for each mixer channel
|
||||
uint32 nltime; // timer variable
|
||||
int32 MinSampleBuffer;
|
||||
|
||||
volatile int16 playing[SAMPLEVOICES]; // sample currently playing
|
||||
volatile int16 smpvol[SAMPLEVOICES];
|
||||
|
||||
volatile uint8 StepChannel = 1;
|
||||
volatile uint8 BackChannel = 0;
|
||||
volatile uint8 SpeechChannel = 5;
|
||||
volatile uint8 SoundFadStatus = 0;
|
||||
|
||||
volatile int16 SoundFadInVal;
|
||||
volatile int16 SoundFadOutVal;
|
||||
|
||||
int fadincount;
|
||||
int fadoutcount;
|
||||
|
||||
extern uint8 *SpeechBuf[2];
|
||||
extern uint8 SpeechTrackEnabled;
|
||||
extern short SpeechON;
|
||||
extern short SpeechVol;
|
||||
extern short MusicVol;
|
||||
extern short SFxVol;
|
||||
void CloseSys(const char *str);
|
||||
void CheckSystem();
|
||||
void ReadExtraObj41D();
|
||||
void StopTalk();
|
||||
|
||||
extern uint8 SoundSystemActive;
|
||||
extern const char *_sysSent[];
|
||||
extern uint16 _curRoom;
|
||||
int SpeechFileLen(const char *name);
|
||||
int SpeechFileRead(const char *name, unsigned char *buf);
|
||||
uint32 ReadTime();
|
||||
|
||||
#define VOLUME(a) ( (a*255)/125 )
|
||||
#define TIME(a) ( (a*3)/50 )
|
||||
#define FADMULT 100
|
||||
/* -----------------05/08/97 16.36-------------------
|
||||
soundtimefunct
|
||||
--------------------------------------------------*/
|
||||
void soundtimefunct() {
|
||||
if (!SoundSystemActive)
|
||||
return;
|
||||
uint32 ctime = g_system->getMillis() / 8; // entra una volta ogni otto
|
||||
|
||||
if (ctime > nltime)
|
||||
nltime = ctime;
|
||||
else
|
||||
return ;
|
||||
|
||||
if (SoundFadStatus) { // solo se sono in un fad
|
||||
if (SoundFadStatus & SFADOUT) {
|
||||
if (!g_system->getMixer()->isSoundHandleActive(smp[BackChannel])) {
|
||||
SoundFadStatus &= (~SFADOUT);
|
||||
} else {
|
||||
fadoutcount ++;
|
||||
|
||||
SoundFadOutVal -= FADMULT;
|
||||
|
||||
if (SoundFadOutVal > 0)
|
||||
g_system->getMixer()->setChannelVolume(smp[BackChannel], VOLUME(SoundFadOutVal / FADMULT));
|
||||
else {
|
||||
SoundFadOutVal = 0;
|
||||
g_system->getMixer()->setChannelVolume(smp[BackChannel], VOLUME(SoundFadOutVal));
|
||||
|
||||
SoundFadStatus &= (~SFADOUT);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (SoundFadStatus & SFADIN) {
|
||||
fadincount ++;
|
||||
|
||||
SoundFadInVal += FADMULT;
|
||||
|
||||
if (SoundFadInVal < (GSample[playing[StepChannel]].volume * FADMULT))
|
||||
g_system->getMixer()->setChannelVolume(smp[StepChannel], VOLUME(SoundFadInVal / FADMULT));
|
||||
else {
|
||||
SoundFadInVal = GSample[playing[StepChannel]].volume * FADMULT;
|
||||
g_system->getMixer()->setChannelVolume(smp[StepChannel], VOLUME(SoundFadInVal / FADMULT));
|
||||
|
||||
//SoundFadStatus &= ( ~SFADIN );
|
||||
}
|
||||
|
||||
for (volatile int a = 2; a < SAMPLEVOICES; a++) {
|
||||
if (playing[a] != 0) {
|
||||
smpvol[a] += FADMULT;
|
||||
|
||||
if (smpvol[a] > GSample[playing[a]].volume * FADMULT)
|
||||
smpvol[a] = GSample[playing[a]].volume * FADMULT;
|
||||
|
||||
g_system->getMixer()->setChannelVolume(smp[a], VOLUME(smpvol[a] / FADMULT));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------05/08/97 16.36-------------------
|
||||
StartSoundSystem
|
||||
--------------------------------------------------*/
|
||||
void StartSoundSystem() {
|
||||
if (g_system->getMixer()->isReady())
|
||||
SoundSystemActive = SOUND_ON;
|
||||
}
|
||||
|
||||
/* -----------------05/08/97 16.35-------------------
|
||||
StopSoundSystem
|
||||
--------------------------------------------------*/
|
||||
void StopSoundSystem() {
|
||||
if (!SoundSystemActive)
|
||||
return;
|
||||
else if (SoundSystemActive == SOUND_ON) {
|
||||
g_system->getMixer()->stopAll();
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------14/08/97 12.06-------------------
|
||||
LoadAudioWav
|
||||
--------------------------------------------------*/
|
||||
short LoadAudioWav(int num, uint8 *wav, int len) {
|
||||
if (!SoundSystemActive)
|
||||
return 0;
|
||||
|
||||
Audio::SeekableAudioStream *stream = Audio::makeWAVStream(new Common::MemoryReadStream(wav, len), DisposeAfterUse::NO);
|
||||
|
||||
if (num != 0xFFFF) {
|
||||
NLSample[num].stream = stream;
|
||||
if (GSample[num].flag & SOUNDFLAG_SBACK)
|
||||
NLSample[num].type = Audio::Mixer::kMusicSoundType;
|
||||
else
|
||||
NLSample[num].type = Audio::Mixer::kSFXSoundType;
|
||||
} else {
|
||||
SpeechSample.stream = stream;
|
||||
SpeechSample.type = Audio::Mixer::kSpeechSoundType;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* -----------------14/08/97 14.08-------------------
|
||||
NLPlaySound
|
||||
--------------------------------------------------*/
|
||||
void NLPlaySound(int num) {
|
||||
int channel;
|
||||
|
||||
if (!SoundSystemActive)
|
||||
return;
|
||||
else if (SoundSystemActive == SOUND_ON) {
|
||||
channel = 2;
|
||||
if (g_system->getMixer()->isSoundHandleActive(smp[channel])) {
|
||||
g_system->getMixer()->stopHandle(smp[channel]);
|
||||
playing[channel] = 0;
|
||||
}
|
||||
|
||||
int volume = VOLUME(GSample[num].volume);
|
||||
|
||||
if (GSample[num].flag & SOUNDFLAG_SON) {
|
||||
volume = 0;
|
||||
smpvol[channel] = 0;
|
||||
}
|
||||
|
||||
Audio::AudioStream *stream = NLSample[num].stream;
|
||||
if (GSample[num].flag & SOUNDFLAG_SLOOP)
|
||||
stream = Audio::makeLoopingAudioStream(NLSample[num].stream, 0);
|
||||
|
||||
g_system->getMixer()->playStream(NLSample[num].type, &smp[channel], stream, -1, volume, 0, DisposeAfterUse::NO);
|
||||
|
||||
playing[channel] = num;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------14/08/97 16.30-------------------
|
||||
NLStopSound
|
||||
--------------------------------------------------*/
|
||||
void NLStopSound(int num) {
|
||||
if (!SoundSystemActive || SoundSystemActive != SOUND_ON)
|
||||
return;
|
||||
|
||||
for (int a = 2; a < SpeechChannel; a++) {
|
||||
if (playing[a] == num) {
|
||||
g_system->getMixer()->stopHandle(smp[a]);
|
||||
playing[a] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------14/08/97 16.30-------------------
|
||||
SoundFadOut
|
||||
--------------------------------------------------*/
|
||||
void SoundFadOut() {
|
||||
if (!SoundSystemActive || SoundSystemActive != SOUND_ON)
|
||||
return;
|
||||
|
||||
for (int a = 0; a < SAMPLEVOICES; a++) { // spegne tutti i canali eccetto il background
|
||||
if (a != BackChannel) {
|
||||
g_system->getMixer()->stopHandle(smp[a]);
|
||||
playing[a] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
SoundFadOutVal = 0;
|
||||
|
||||
SoundFadOutVal = g_system->getMixer()->getChannelVolume(smp[BackChannel]) * FADMULT;
|
||||
SoundFadStatus = SFADOUT;
|
||||
}
|
||||
|
||||
/* -----------------14/08/97 16.30-------------------
|
||||
SoundFadIn
|
||||
--------------------------------------------------*/
|
||||
void SoundFadIn(int num) {
|
||||
if (!SoundSystemActive || SoundSystemActive != SOUND_ON)
|
||||
return;
|
||||
|
||||
g_system->getMixer()->playStream(NLSample[num].type, &smp[StepChannel], NLSample[num].stream, -1, 0, 0, DisposeAfterUse::NO);
|
||||
|
||||
playing[StepChannel] = num;
|
||||
|
||||
SoundFadInVal = 0;
|
||||
SoundFadStatus |= SFADIN;
|
||||
}
|
||||
|
||||
/* -----------------14/08/97 16.31-------------------
|
||||
WaitSoundFadEnd
|
||||
--------------------------------------------------*/
|
||||
void WaitSoundFadEnd() {
|
||||
if (!SoundSystemActive) {
|
||||
if (_curRoom == r41D)
|
||||
ReadExtraObj41D();
|
||||
return;
|
||||
}
|
||||
|
||||
while ((SoundFadInVal != (GSample[playing[StepChannel]].volume * FADMULT)) && (playing[StepChannel] != 0) && (SoundFadOutVal != 0))
|
||||
CheckSystem();
|
||||
SoundFadStatus = 0;
|
||||
|
||||
g_system->getMixer()->stopHandle(smp[BackChannel]);
|
||||
|
||||
g_system->getMixer()->setChannelVolume(smp[StepChannel], VOLUME(GSample[playing[StepChannel]].volume));
|
||||
playing[BackChannel] = 0;
|
||||
|
||||
for (uint8 a = 2; a < SpeechChannel; a++)
|
||||
if (playing[a] != 0)
|
||||
g_system->getMixer()->setChannelVolume(smp[a], VOLUME(GSample[playing[a]].volume));
|
||||
|
||||
SWAP(StepChannel, BackChannel);
|
||||
|
||||
if (_curRoom == r41D)
|
||||
ReadExtraObj41D();
|
||||
}
|
||||
|
||||
/* -----------------14/08/97 16.31-------------------
|
||||
SounPasso
|
||||
--------------------------------------------------*/
|
||||
void SoundPasso(int midx, int midz, int act, int frame, unsigned short *list) {
|
||||
extern unsigned char _defActionLen[];
|
||||
int b;
|
||||
|
||||
if (!SoundSystemActive)
|
||||
return;
|
||||
|
||||
int StepRight = 0;
|
||||
int StepLeft = 0;
|
||||
|
||||
switch (act) {
|
||||
case hWALK:
|
||||
if (frame == 3)
|
||||
StepLeft = 1;
|
||||
else if (frame == 8)
|
||||
StepRight = 1;
|
||||
break;
|
||||
|
||||
case hWALKIN:
|
||||
if (frame == 3)
|
||||
StepLeft = 1;
|
||||
else if (frame == 9)
|
||||
StepRight = 1;
|
||||
break;
|
||||
|
||||
case hWALKOUT:
|
||||
if (frame == 5)
|
||||
StepLeft = 1;
|
||||
else if (frame == 10)
|
||||
StepRight = 1;
|
||||
break;
|
||||
|
||||
case hSTOP0:
|
||||
case hSTOP1:
|
||||
case hSTOP2:
|
||||
case hSTOP3:
|
||||
case hSTOP9:
|
||||
if (frame >= (_defActionLen[act] - 1))
|
||||
StepLeft = 1;
|
||||
case hSTOP4:
|
||||
case hSTOP5:
|
||||
case hSTOP6:
|
||||
case hSTOP7:
|
||||
case hSTOP8:
|
||||
if (frame >= (_defActionLen[act] - 1))
|
||||
StepRight = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(StepRight) && !(StepLeft))
|
||||
return;
|
||||
|
||||
for (int a = 0; a < MAXSOUNDSINROOM; a++) {
|
||||
b = list[a];
|
||||
|
||||
if ((StepRight) && (GSample[b].flag & SOUNDFLAG_SPDX))
|
||||
break;
|
||||
if ((StepLeft) && (GSample[b].flag & SOUNDFLAG_SPSX))
|
||||
break;
|
||||
if (b == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
if (midz < 0)
|
||||
midz = -midz;
|
||||
|
||||
midz = ((int)(GSample[b].volume) * 1000) / midz;
|
||||
|
||||
if (midz > 255)
|
||||
midz = 255;
|
||||
|
||||
int St = StepChannel;
|
||||
|
||||
g_system->getMixer()->stopHandle(smp[St]);
|
||||
NLSample[b].stream->rewind();
|
||||
|
||||
int panpos = ((midx - 320) * 127 / 320) / 2;
|
||||
|
||||
g_system->getMixer()->playStream(NLSample[b].type, &smp[St], NLSample[b].stream, -1, VOLUME(midz), panpos, DisposeAfterUse::NO);
|
||||
}
|
||||
|
||||
void ContinueTalk() {
|
||||
if (!SpeechTrackEnabled)
|
||||
return;
|
||||
|
||||
if (!g_system->getMixer()->isSoundHandleActive(smp[SpeechChannel]))
|
||||
StopTalk();
|
||||
}
|
||||
|
||||
int32 Talk(const char *name) {
|
||||
StopTalk();
|
||||
|
||||
int Len = SpeechFileLen(name);
|
||||
if ((Len > SPEECHSIZE) || (SoundSystemActive == SOUND_OFF) || (SpeechON == 0)) {
|
||||
SpeechTrackEnabled = 0;
|
||||
return ((Len * 60L) / (11025));
|
||||
}
|
||||
if (SpeechFileRead(name, SpeechBuf[0]) == 0) {
|
||||
SpeechTrackEnabled = 0;
|
||||
return ((Len * 60L) / (11025));
|
||||
}
|
||||
|
||||
SpeechTrackEnabled = 1;
|
||||
if (LoadAudioWav(0xFFFF, SpeechBuf[0], Len))
|
||||
Len *= 2;
|
||||
|
||||
if ((SoundSystemActive == SOUND_OFF) || (SpeechON == 0))
|
||||
SpeechTrackEnabled = 0;
|
||||
else {
|
||||
extern uint32 CharacterSpeakTime;
|
||||
g_system->getMixer()->playStream(SpeechSample.type, &smp[SpeechChannel], SpeechSample.stream);
|
||||
CharacterSpeakTime = ReadTime();
|
||||
}
|
||||
|
||||
return TIME(SpeechSample.stream->getLength().msecs());
|
||||
}
|
||||
|
||||
void StopTalk() {
|
||||
if (SoundSystemActive)
|
||||
g_system->getMixer()->stopHandle(smp[SpeechChannel]);
|
||||
|
||||
SpeechTrackEnabled = 0;
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
179
engines/trecision/nl/sysdef.h
Normal file
179
engines/trecision/nl/sysdef.h
Normal file
@ -0,0 +1,179 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
Game Structure
|
||||
******************************************************************************/
|
||||
#define MAXROOMS 100 // Game rooms
|
||||
#define MAXOBJ 1400 // Game objects
|
||||
#define MAXANIM 750 // Animations
|
||||
#define MAXICON 82 // Inventory icons
|
||||
#define MAXINVENTORY 150 // Inventory Items
|
||||
#define MAXSAMPLE 145 // Maximum number of samples in the game
|
||||
#define MAXATFDO 30
|
||||
|
||||
#define MAXOBJINROOM 128 // Objects per room
|
||||
#define MAXSOUNDSINROOM 15 // Sounds per room
|
||||
#define MAXACTIONINROOM 32 // Number of actions per room
|
||||
#define MAXACTION 620 // Number of actions in the game
|
||||
#define MAXACTIONFRAMESINROOM 1200 // Number of action frames per room
|
||||
|
||||
#define MAXSENTENCE 4000 // Max Examine phrases
|
||||
#define MAXOBJNAME 1400
|
||||
|
||||
#define MAXSCRIPTFRAME 50
|
||||
#define MAXSCRIPT 15
|
||||
|
||||
#define MAXDIALOG 70
|
||||
#define MAXCHOICE 1000
|
||||
#define MAXSUBTITLES 1500
|
||||
#define MAXDISPSCELTE 5
|
||||
#define MAXNEWSMKPAL 40
|
||||
|
||||
// define smacker animations
|
||||
#define MAXCHILD 4
|
||||
#define MAXATFRAME 16
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
Null Objects
|
||||
******************************************************************************/
|
||||
#define NO_OBJECTS 0
|
||||
#define NO_FRAME 0
|
||||
|
||||
/******************************************************************************
|
||||
******************************************************************************/
|
||||
#define SET_BITS_ON(var,bits) (var) |= (bits)
|
||||
#define SET_BITS_OFF(var,bits) (var) &= ~(bits)
|
||||
#define TEST_BITS_ON(var, bits) ( ((var) & (bits)) )
|
||||
#define TEST_BITS_OFF(var,bits) ( !((var) & (bits)) )
|
||||
|
||||
/******************************************************************************
|
||||
Screen management
|
||||
******************************************************************************/
|
||||
#define MAXX 640
|
||||
#define MAXY 480
|
||||
#define SCREENLEN 640
|
||||
/*PELS: define game area (you have to recompile everything!!!) **************/
|
||||
#define AREA 360
|
||||
#define TOP ((MAXY-AREA)/2) // Coordinate y of game screen
|
||||
#define VIDEOTOP TOP
|
||||
#define ZBUFFERSIZE 200000L
|
||||
#define MAXSFXSIZE 951000L
|
||||
#define SPEECHSIZE 300000L
|
||||
/******************************************************************************
|
||||
Time Management
|
||||
******************************************************************************/
|
||||
#define ONESECOND 60
|
||||
#define TIMETOSPEAK (3*ONESECOND) // Timing for the dialogs
|
||||
|
||||
/******************************************************************************
|
||||
Low level text and color management
|
||||
******************************************************************************/
|
||||
#define CARHEI 10
|
||||
#define MAXDTEXTLINES 20
|
||||
#define MAXDTEXTCHARS 128
|
||||
#define MAXCHARS 128
|
||||
|
||||
#define MAXLENSUBSTRING 128
|
||||
#define MAXSUBSTRING 16
|
||||
|
||||
#define MOUSECOL 0x7FFF
|
||||
#define HRED 0x7C00
|
||||
#define HBLUE 0x001F
|
||||
#define HGREEN 0x03E0
|
||||
#define HCYAN 0x03FF
|
||||
#define HMAGENTA 0x7C1F
|
||||
#define HYELLOW 0x7FE0
|
||||
#define HWHITE 0x7777
|
||||
#define HGRAYLT 0x2108
|
||||
#define HGRAYDK 0x4210
|
||||
#define HBLUELT 0x0010
|
||||
/******************************************************************************
|
||||
High level color management
|
||||
******************************************************************************/
|
||||
#define COLOR_HOMO HYELLOW
|
||||
#define COLOR_OBJECT HWHITE
|
||||
#define COLOR_INVENTORY HBLUE
|
||||
|
||||
/******************************************************************************
|
||||
Inventory
|
||||
******************************************************************************/
|
||||
#define INV_ON 1 // Active
|
||||
#define INV_INACTION 2 // In use (the mouse is in the bottom)
|
||||
#define INV_PAINT 4 // Not yet ON (Going down)
|
||||
#define INV_DEPAINT 8 // Not yet OFF (Going up)
|
||||
#define INV_OFF 16 // Not on screen
|
||||
|
||||
#define INVENTORY_HIDE 40 // ICONDY ...era a 48. PELS
|
||||
#define INVENTORY_SHOW 0
|
||||
|
||||
/******************************************************************************
|
||||
Inventory icon management
|
||||
******************************************************************************/
|
||||
#define FIRSTLINE (TOP+AREA) // First line of the inventory
|
||||
#define ICONDY 40 // Icon Height
|
||||
#define ICONDX 48 // Icon width
|
||||
#define ICONSHOWN 12 // Icons showed simultaneously
|
||||
#define INVSCROLLSP 5 // Scrolling speed
|
||||
#define ICONMARGDX 32 // Right margin
|
||||
#define ICONMARGSX 32 // Left margin
|
||||
|
||||
/******************************************************************************
|
||||
Management of "Use with"
|
||||
******************************************************************************/
|
||||
#define USED 0
|
||||
#define WITH 1
|
||||
|
||||
/******************************************************************************
|
||||
Management of cards for Regen
|
||||
******************************************************************************/
|
||||
#define TYPO_ANI 1
|
||||
#define TYPO_BMP 2
|
||||
|
||||
//uint32 ReadTime();
|
||||
#define MAXMESSAGE 128
|
||||
|
||||
|
||||
#define DEFAULTACTIONS 19 // Number of default actions
|
||||
|
||||
|
||||
#define DLG_SHOW 0
|
||||
#define DLG_HIDE 1
|
||||
#define DLG_SELECT 2
|
||||
|
||||
/* MACROS */
|
||||
#define BETWEEN(a,x,b) ((x>=a) && (x<=b))
|
||||
#define GAMEAREA(my) BETWEEN(VideoCent.y0,my,VideoCent.y1)
|
||||
#define INVAREA(my) (my>=VideoBott.y0)
|
||||
#define ICONAREA(mx,my) ((my>=VideoBott.y0) && (my</*=VideoBott.y0+ICONDY*/MAXY) && (mx>=ICONMARGSX) && (mx<=SCREENLEN-ICONMARGDX))
|
||||
#define REEVENT doEvent(TheMessage->cls,TheMessage->event,TheMessage->priority,TheMessage->wparam1,TheMessage->wparam2,TheMessage->bparam,TheMessage->lparam)
|
||||
|
||||
|
||||
#define COLOR_ARG HWHITE
|
||||
#define COLOR_ARG_PT HYELLOW
|
||||
|
||||
#define dONETIME 1
|
||||
#define dPARTISUBITO 2
|
||||
#define dACTIVATE 4
|
||||
#define dDEACTIVATE 8
|
||||
#define dPREVARICA 16
|
68
engines/trecision/nl/text.cpp
Normal file
68
engines/trecision/nl/text.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "trecision/nl/lib/addtype.h"
|
||||
#include "trecision/nl/sysdef.h"
|
||||
#include "trecision/nl/struct.h"
|
||||
#include "trecision/nl/extern.h"
|
||||
#include "trecision/nl/define.h"
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
extern const char *_sysSent[];
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* INIT OBJ NAMES */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void initNames() {
|
||||
_sysSent[1] = "NightLong was not properly installed!\nRun Autorun.exe from the CD-Rom."; // llscreen
|
||||
_sysSent[2] = "Not enough memory!\nYou need %d bytes more.\n"; // llscreen
|
||||
_sysSent[3] = "Unknown error\n"; // maindos
|
||||
_sysSent[4] = "Please insert CD number %c and press return."; // llmouse
|
||||
_sysSent[5] = "Unknown error"; // llscreen
|
||||
_sysSent[6] = "VESA Not Supported.\n"; // maindos
|
||||
_sysSent[7] = "Error reading file."; // lldec
|
||||
_sysSent[8] = "Mouse not found error!\n"; // maindos
|
||||
_sysSent[9] = "SAVE POSITION"; // llmouse ###
|
||||
_sysSent[10] = "EMPTY SLOT"; // llmouse ###
|
||||
_sysSent[11] = "LOAD POSITION"; // llmouse ###
|
||||
_sysSent[12] = "Error reading saved-game"; // llmouse
|
||||
_sysSent[13] = "Are you sure that you want to quit (y/n)?"; // llmouse ###
|
||||
_sysSent[14] = "Unknown error\n"; // soundw95
|
||||
_sysSent[15] = "Sample handle not available\n"; // sounddos
|
||||
_sysSent[16] = "Run NL to select an appropriate digital audio driver\n"; // sounddos
|
||||
_sysSent[17] = "This demo is over."; // llmouse ###
|
||||
_sysSent[18] = "NightLong"; // win name - mainw95
|
||||
_sysSent[19] = "ERROR!"; // llmouse
|
||||
_sysSent[20] = "Unsupported pixel format."; // mainw95
|
||||
_sysSent[21] = "DirectX Error"; // mainw95
|
||||
_sysSent[22] = "NightLong Warning"; // mainw95
|
||||
_sysSent[23] = "Use "; // string
|
||||
_sysSent[24] = " with "; // string
|
||||
_sysSent[25] = "Go to "; // string
|
||||
_sysSent[26] = "Go to ... "; // string
|
||||
// The following are missing: FastFile, Init, Do, Utility
|
||||
|
||||
Sentence[0] = " "; // Use it like a buffer !!!!
|
||||
ObjName[0] = " ";
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
633
engines/trecision/nl/utility.cpp
Normal file
633
engines/trecision/nl/utility.cpp
Normal file
@ -0,0 +1,633 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <conio.h>
|
||||
#include <string.h>
|
||||
#include "trecision/nl/lib/addtype.h"
|
||||
#include "trecision/nl/sysdef.h"
|
||||
#include "trecision/nl/struct.h"
|
||||
#include "trecision/nl/define.h"
|
||||
#include "trecision/nl/message.h"
|
||||
#include "trecision/nl/ll/llinc.h"
|
||||
#include "trecision/nl/extern.h"
|
||||
#include "trecision/nl/3d/3dinc.h"
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
#define SendFrame(i) doEvent(ScriptFrame[i].cls, \
|
||||
ScriptFrame[i].event, \
|
||||
MP_DEFAULT, \
|
||||
ScriptFrame[i].wparam1, \
|
||||
ScriptFrame[i].wparam2, \
|
||||
ScriptFrame[i].bparam , \
|
||||
ScriptFrame[i].lparam)
|
||||
|
||||
uint8 CurStack = 0;
|
||||
|
||||
#define MAXTEXTSTACK 3
|
||||
|
||||
struct StackText {
|
||||
uint16 x;
|
||||
uint16 y;
|
||||
uint16 tcol, scol;
|
||||
char sign[256];
|
||||
LLBOOL Clear;
|
||||
} TextStack[MAXTEXTSTACK];
|
||||
|
||||
int16 TextStackTop = -1;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* ONELEFTINVENTORY */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void OneLeftInventory() {
|
||||
extern short RightArrow;
|
||||
if (TheIconBase < _inventorySize - ICONSHOWN)
|
||||
TheIconBase ++;
|
||||
RegenInv(TheIconBase, INVENTORY_SHOW);
|
||||
RightArrow = 1;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* ONERIGHTINVENTORY */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void OneRightInventory() {
|
||||
extern short LeftArrow;
|
||||
if (TheIconBase > 0)
|
||||
TheIconBase --;
|
||||
RegenInv(TheIconBase, INVENTORY_SHOW);
|
||||
LeftArrow = 1;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* WHATICON */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
uint8 WhatIcon(uint16 invmx) {
|
||||
if (invmx < ICONMARGSX)
|
||||
return 0;
|
||||
if (invmx > (SCREENLEN - ICONMARGDX))
|
||||
return 0;
|
||||
|
||||
return _inventory[(TheIconBase + ((invmx - ICONMARGSX) / (ICONDX)))];
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* ICONPOS */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
uint8 IconPos(uint8 icon) {
|
||||
uint8 i;
|
||||
|
||||
for (i = 0; i < MAXICON; i++) {
|
||||
if (_inventory[i] == icon)
|
||||
break;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* KILLICON */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void KillIcon(uint8 icon) {
|
||||
uint8 pos = IconPos(icon);
|
||||
|
||||
if (pos == MAXICON)
|
||||
return;
|
||||
_inventory[pos] = iNULL;
|
||||
for (; pos < _inventorySize; pos++)
|
||||
_inventory[pos] = _inventory[pos + 1];
|
||||
_inventorySize --;
|
||||
|
||||
if (_inventorySize < ICONSHOWN)
|
||||
TheIconBase = 0;
|
||||
|
||||
if ((TheIconBase) && (_inventorySize > ICONSHOWN) && (_inventory[TheIconBase + ICONSHOWN] == iNULL))
|
||||
// TheIconBase --;
|
||||
TheIconBase = _inventorySize - ICONSHOWN;
|
||||
|
||||
RepaintString();
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* ADDICON */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void AddIcon(uint8 icon) {
|
||||
if (IconPos(icon) != MAXICON)
|
||||
return;
|
||||
_inventory[_inventorySize++] = icon;
|
||||
if (_inventorySize >= MAXICON)
|
||||
warning("AddIcon overflow");
|
||||
|
||||
if (TheIconBase < _inventorySize - ICONSHOWN)
|
||||
// TheIconBase ++;
|
||||
TheIconBase = _inventorySize - ICONSHOWN;
|
||||
|
||||
// To show the icon that enters the inventory
|
||||
// doEvent(MC_INVENTORY,ME_OPEN,MP_DEFAULT,0,0,0,0);
|
||||
// SemForceRegenInventory = true;
|
||||
RepaintString();
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* REPLACEICON */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void ReplaceIcon(uint8 oldicon, uint8 newicon) {
|
||||
uint8 pos = IconPos(oldicon);
|
||||
|
||||
_inventory[pos] = newicon;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* REGENINV */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void RegenInv(uint8 StartIcon, uint8 StartLine) {
|
||||
RegenInvStartIcon = StartIcon;
|
||||
RegenInvStartLine = StartLine;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* ENDSCRIPT */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void EndScript() {
|
||||
CurStack--;
|
||||
if (CurStack == 0) {
|
||||
Semscriptactive = false;
|
||||
SemMouseEnabled = true;
|
||||
RepaintString();
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* PLAYSCRIPT */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void PlayScript(uint16 i) {
|
||||
CurStack++;
|
||||
Semscriptactive = true;
|
||||
SemMouseEnabled = false;
|
||||
CurScriptFrame[CurStack] = Script[i].firstframe;
|
||||
|
||||
// se evento vuoto termina lo scrpt
|
||||
if ((ScriptFrame[CurScriptFrame[CurStack]].cls == 0) && (ScriptFrame[CurScriptFrame[CurStack]].event == 0)) {
|
||||
EndScript();
|
||||
return;
|
||||
}
|
||||
|
||||
LOOP:
|
||||
SendFrame(CurScriptFrame[CurStack]);
|
||||
if ((ScriptFrame[CurScriptFrame[CurStack]].nowait) && !((ScriptFrame[CurScriptFrame[CurStack] + 1].cls == 0) && (ScriptFrame[CurScriptFrame[CurStack] + 1].event == 0))) {
|
||||
CurScriptFrame[CurStack]++;
|
||||
goto LOOP;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* EVALSCRIPT */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void EvalScript() {
|
||||
if ((TestEmptyHomoQueue4Script(&Homo) && (TestEmptyQueue(&Game, MC_DIALOG)) && (SemScreenRefreshed))) {
|
||||
//if(( Homo.len == 0 ) && (TestEmptyQueue(&Game,MC_DIALOG)) && (SemScreenRefreshed)) {
|
||||
CurScriptFrame[CurStack]++;
|
||||
SemMouseEnabled = false;
|
||||
|
||||
if ((ScriptFrame[CurScriptFrame[CurStack]].cls == 0) && (ScriptFrame[CurScriptFrame[CurStack]].event == 0)) {
|
||||
EndScript();
|
||||
return;
|
||||
}
|
||||
|
||||
LOOP:
|
||||
SendFrame(CurScriptFrame[CurStack]);
|
||||
if ((ScriptFrame[CurScriptFrame[CurStack]].nowait) && !((ScriptFrame[CurScriptFrame[CurStack] + 1].cls == 0) && (ScriptFrame[CurScriptFrame[CurStack] + 1].event == 0))) {
|
||||
CurScriptFrame[CurStack]++;
|
||||
goto LOOP;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* TEXT */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void Text(uint16 x, uint16 y, const char *sign, uint16 tcol, uint16 scol) {
|
||||
TextStackTop++;
|
||||
if (TextStackTop >= MAXTEXTSTACK) {
|
||||
warning("MaxTextStackReached!");
|
||||
return;
|
||||
}
|
||||
|
||||
TextStack[TextStackTop].x = x;
|
||||
TextStack[TextStackTop].y = y;
|
||||
TextStack[TextStackTop].tcol = tcol;
|
||||
TextStack[TextStackTop].scol = scol;
|
||||
TextStack[TextStackTop].Clear = false;
|
||||
strcpy(TextStack[TextStackTop].sign, sign);
|
||||
}
|
||||
|
||||
/* -----------------08/07/97 22.13-------------------
|
||||
ClearText
|
||||
--------------------------------------------------*/
|
||||
void ClearText() {
|
||||
if (TextStackTop >= 0) {
|
||||
// lo stack non e' vuoto
|
||||
if (! TextStack[TextStackTop].Clear)
|
||||
// il precedente e' una stringa da scrivere, torno indietro
|
||||
TextStackTop--;
|
||||
} else {
|
||||
// lo stack e' vuoto
|
||||
TextStackTop = 0;
|
||||
TextStack[TextStackTop].Clear = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------08/07/97 22.14-------------------
|
||||
PaintString
|
||||
--------------------------------------------------*/
|
||||
void PaintString() {
|
||||
for (int16 i = 0; i <= TextStackTop; i++) {
|
||||
if (TextStack[i].Clear) {
|
||||
DoClearText();
|
||||
} else {
|
||||
DoText(TextStack[i].x, TextStack[i].y,
|
||||
TextStack[i].sign,
|
||||
TextStack[i].tcol, TextStack[i].scol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------08/07/97 22.15-------------------
|
||||
DoText
|
||||
--------------------------------------------------*/
|
||||
void DoText(uint16 x, uint16 y, const char *sign, uint16 tcol, uint16 scol) {
|
||||
uint16 hstring;
|
||||
|
||||
TheString.x = x;
|
||||
TheString.y = y;
|
||||
TheString.dx = TextLength(sign, 0);
|
||||
if ((y == (MAXY - CARHEI)) && (TheString.dx > 600)) TheString.dx = TheString.dx * 3 / 5;
|
||||
else if ((y != (MAXY - CARHEI)) && (TheString.dx > 960)) TheString.dx = TheString.dx * 2 / 5;
|
||||
else if ((y != (MAXY - CARHEI)) && (TheString.dx > 320)) TheString.dx = TheString.dx * 3 / 5;
|
||||
TheString.sign = sign;
|
||||
TheString.l[0] = 0;
|
||||
TheString.l[1] = 0;
|
||||
TheString.l[2] = TheString.dx;
|
||||
TheString.l[3] = (hstring = CheckDText(TheString));
|
||||
TheString.dy = hstring;
|
||||
TheString.tcol = tcol;
|
||||
TheString.scol = scol;
|
||||
|
||||
if (TheString.y <= hstring)
|
||||
TheString.y += hstring;
|
||||
else
|
||||
TheString.y -= hstring;
|
||||
|
||||
if (TheString.y <= VIDEOTOP)
|
||||
TheString.y = VIDEOTOP + 1;
|
||||
|
||||
|
||||
TextStatus |= TEXT_DRAW;
|
||||
}
|
||||
|
||||
|
||||
/* -----------------08/07/97 22.15-------------------
|
||||
DoClearString
|
||||
--------------------------------------------------*/
|
||||
void DoClearText() {
|
||||
if ((OldString.sign == NULL) && (TheString.sign)) {
|
||||
OldString.x = TheString.x;
|
||||
OldString.y = TheString.y;
|
||||
OldString.dx = TheString.dx;
|
||||
OldString.dy = TheString.dy;
|
||||
OldString.sign = TheString.sign;
|
||||
OldString.l[0] = TheString.l[0];
|
||||
OldString.l[1] = TheString.l[1];
|
||||
OldString.l[2] = TheString.l[2];
|
||||
OldString.l[3] = TheString.l[3];
|
||||
OldString.tcol = TheString.tcol;
|
||||
OldString.scol = TheString.scol;
|
||||
TheString.sign = NULL;
|
||||
|
||||
TextStatus |= TEXT_DEL;
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------21/01/98 10.22-------------------
|
||||
* DoSys
|
||||
* --------------------------------------------------*/
|
||||
void DoSys(uint16 TheObj) {
|
||||
extern short SpeechON;
|
||||
extern short TextON;
|
||||
extern short SFxVol;
|
||||
extern short SpeechVol;
|
||||
extern short MusicVol;
|
||||
|
||||
switch (TheObj) {
|
||||
case o00QUIT:
|
||||
if (QuitGame())
|
||||
doEvent(MC_SYSTEM, ME_QUIT, MP_SYSTEM, 0, 0, 0, 0);
|
||||
break;
|
||||
|
||||
case o00EXIT:
|
||||
if (OldRoom == rSYS)
|
||||
break;
|
||||
doEvent(MC_SYSTEM, ME_CHANGEROOM, MP_SYSTEM, _obj[o00EXIT]._goRoom, 0, 0, 0);
|
||||
break;
|
||||
|
||||
case o00SAVE:
|
||||
if (OldRoom == rSYS)
|
||||
break;
|
||||
_curRoom = _obj[o00EXIT]._goRoom;
|
||||
SemSaveInventory = true;
|
||||
if (!DataSave()) {
|
||||
ShowInvName(NO_OBJECTS, false);
|
||||
doEvent(MC_INVENTORY, ME_SHOWICONNAME, MP_DEFAULT, mx, my, 0, 0);
|
||||
// RegenInventory(RegenInvStartIcon,RegenInvStartLine);
|
||||
doEvent(MC_SYSTEM, ME_CHANGEROOM, MP_SYSTEM, _obj[o00EXIT]._goRoom, 0, 0, 0);
|
||||
}
|
||||
_curRoom = rSYS;
|
||||
break;
|
||||
|
||||
case o00LOAD:
|
||||
if (!DataLoad()) {
|
||||
ShowInvName(NO_OBJECTS, false);
|
||||
doEvent(MC_INVENTORY, ME_SHOWICONNAME, MP_DEFAULT, mx, my, 0, 0);
|
||||
// RegenInventory(RegenInvStartIcon,RegenInvStartLine);
|
||||
}
|
||||
break;
|
||||
|
||||
case o00SPEECHON:
|
||||
if (TextON) {
|
||||
_obj[o00SPEECHON]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[o00SPEECHOFF]._mode |= OBJMODE_OBJSTATUS;
|
||||
SpeechON = false;
|
||||
_curObj = o00SPEECHOFF;
|
||||
RegenRoom();
|
||||
ShowObjName(_curObj, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case o00SPEECHOFF:
|
||||
_obj[o00SPEECHOFF]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[o00SPEECHON]._mode |= OBJMODE_OBJSTATUS;
|
||||
SpeechON = true;
|
||||
_curObj = o00SPEECHON;
|
||||
RegenRoom();
|
||||
ShowObjName(_curObj, true);
|
||||
break;
|
||||
|
||||
case o00TEXTON:
|
||||
if (SpeechON) {
|
||||
_obj[o00TEXTON]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[o00TEXTOFF]._mode |= OBJMODE_OBJSTATUS;
|
||||
TextON = false;
|
||||
_curObj = o00TEXTOFF;
|
||||
RegenRoom();
|
||||
ShowObjName(_curObj, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case o00TEXTOFF:
|
||||
_obj[o00TEXTOFF]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[o00TEXTON]._mode |= OBJMODE_OBJSTATUS;
|
||||
TextON = true;
|
||||
_curObj = o00TEXTON;
|
||||
RegenRoom();
|
||||
ShowObjName(_curObj, true);
|
||||
break;
|
||||
|
||||
case o00SPEECH1D:
|
||||
case o00SPEECH2D:
|
||||
case o00SPEECH3D:
|
||||
case o00SPEECH4D:
|
||||
case o00SPEECH5D:
|
||||
case o00SPEECH6D:
|
||||
case o00MUSIC1D:
|
||||
case o00MUSIC2D:
|
||||
case o00MUSIC3D:
|
||||
case o00MUSIC4D:
|
||||
case o00MUSIC5D:
|
||||
case o00MUSIC6D:
|
||||
case o00SOUND1D:
|
||||
case o00SOUND2D:
|
||||
case o00SOUND3D:
|
||||
case o00SOUND4D:
|
||||
case o00SOUND5D:
|
||||
case o00SOUND6D:
|
||||
_obj[TheObj]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
if ((TheObj != o00SPEECH6D) && (TheObj != o00MUSIC6D) && (TheObj != o00SOUND6D))
|
||||
_obj[TheObj + 1]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[TheObj - 1]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[TheObj - 2]._mode |= OBJMODE_OBJSTATUS;
|
||||
RegenRoom();
|
||||
if (TheObj < o00MUSIC1D)
|
||||
SpeechVol = ((TheObj - 2 - o00SPEECH1D) / 2) * 25;
|
||||
else if (TheObj > o00MUSIC6D)
|
||||
SFxVol = ((TheObj - 2 - o00SOUND1D) / 2) * 25;
|
||||
else
|
||||
MusicVol = ((TheObj - 2 - o00MUSIC1D) / 2) * 25;
|
||||
break;
|
||||
|
||||
case o00SPEECH1U:
|
||||
case o00SPEECH2U:
|
||||
case o00SPEECH3U:
|
||||
case o00SPEECH4U:
|
||||
case o00SPEECH5U:
|
||||
case o00MUSIC1U:
|
||||
case o00MUSIC2U:
|
||||
case o00MUSIC3U:
|
||||
case o00MUSIC4U:
|
||||
case o00MUSIC5U:
|
||||
case o00SOUND1U:
|
||||
case o00SOUND2U:
|
||||
case o00SOUND3U:
|
||||
case o00SOUND4U:
|
||||
case o00SOUND5U:
|
||||
_obj[TheObj]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[TheObj - 1]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[TheObj + 1]._mode |= OBJMODE_OBJSTATUS;
|
||||
if ((TheObj != o00SPEECH5U) && (TheObj != o00MUSIC5U) && (TheObj != o00SOUND5U))
|
||||
_obj[TheObj + 2]._mode |= OBJMODE_OBJSTATUS;
|
||||
RegenRoom();
|
||||
if (TheObj < o00MUSIC1D)
|
||||
SpeechVol = ((TheObj + 1 - o00SPEECH1D) / 2) * 25;
|
||||
else if (TheObj > o00MUSIC6D)
|
||||
SFxVol = ((TheObj + 1 - o00SOUND1D) / 2) * 25;
|
||||
else
|
||||
MusicVol = ((TheObj + 1 - o00MUSIC1D) / 2) * 25;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------09/02/98 15.44-------------------
|
||||
* SetRoom
|
||||
* --------------------------------------------------*/
|
||||
void SetRoom(unsigned short r, bool b) {
|
||||
switch (r) {
|
||||
case r21:
|
||||
if (!b) {
|
||||
read3D("21.3d");
|
||||
Room[r21]._flag &= ~OBJFLAG_EXTRA;
|
||||
setPosition(14);
|
||||
_obj[oCATENAT21]._position = 5;
|
||||
_obj[oUSCITA21]._position = 11;
|
||||
|
||||
// se so come andare di la'
|
||||
if (((IconPos(iSBARRA21) != MAXICON) && ((_choice[436]._flag & OBJFLAG_DONE) || (_choice[466]._flag & OBJFLAG_DONE)))
|
||||
|| ((_choice[451]._flag & OBJFLAG_DONE) || (_choice[481]._flag & OBJFLAG_DONE))) {
|
||||
_obj[od21ALLA23]._flag |= OBJFLAG_ROOMOUT;
|
||||
_obj[od21ALLA23]._flag &= ~OBJFLAG_EXAMINE;
|
||||
} else {
|
||||
_obj[od21ALLA23]._flag &= ~OBJFLAG_ROOMOUT;
|
||||
_obj[od21ALLA23]._flag |= OBJFLAG_EXAMINE;
|
||||
}
|
||||
_obj[od21ALLA23]._anim = 0;
|
||||
_obj[oUSCITA21]._mode |= OBJMODE_OBJSTATUS;
|
||||
|
||||
_obj[od21ALLA22]._flag |= OBJFLAG_ROOMOUT;
|
||||
_obj[od21ALLA22]._flag &= ~OBJFLAG_EXAMINE;
|
||||
_obj[od21ALLA22]._anim = aWALKOUT;
|
||||
_obj[oPORTAA21]._anim = a212;
|
||||
_obj[oPORTAC21]._anim = a219;
|
||||
|
||||
_obj[oCUNICOLO21]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[oCARTELLONE21]._mode |= OBJMODE_OBJSTATUS;
|
||||
} else {
|
||||
read3D("212.3d");
|
||||
Room[r21]._flag |= OBJFLAG_EXTRA;
|
||||
setPosition(15);
|
||||
_obj[oCATENAT21]._position = 6;
|
||||
_obj[oUSCITA21]._position = 21;
|
||||
|
||||
_obj[od21ALLA23]._flag |= OBJFLAG_ROOMOUT;
|
||||
_obj[od21ALLA23]._flag &= ~OBJFLAG_EXAMINE;
|
||||
_obj[od21ALLA23]._anim = aWALKOUT;
|
||||
_obj[oUSCITA21]._mode |= OBJMODE_OBJSTATUS;
|
||||
|
||||
// se so come andare di la'
|
||||
if (((IconPos(iSBARRA21) != MAXICON) && ((_choice[436]._flag & OBJFLAG_DONE) || (_choice[466]._flag & OBJFLAG_DONE)))
|
||||
|| ((_choice[451]._flag & OBJFLAG_DONE) || (_choice[481]._flag & OBJFLAG_DONE))) {
|
||||
_obj[od21ALLA22]._flag |= OBJFLAG_ROOMOUT;
|
||||
_obj[od21ALLA22]._flag &= ~OBJFLAG_EXAMINE;
|
||||
} else {
|
||||
_obj[od21ALLA22]._flag &= ~OBJFLAG_ROOMOUT;
|
||||
_obj[od21ALLA22]._flag |= OBJFLAG_EXAMINE;
|
||||
}
|
||||
_obj[od21ALLA22]._anim = 0;
|
||||
_obj[od21ALLA22]._examine = 335;
|
||||
_obj[od21ALLA22]._action = 335;
|
||||
_obj[oPORTAA21]._anim = 0;
|
||||
_obj[oPORTAC21]._anim = 0;
|
||||
|
||||
_obj[oCUNICOLO21]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[oCARTELLONE21]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
}
|
||||
break;
|
||||
case r24:
|
||||
if (!b) {
|
||||
read3D("24.3d");
|
||||
Room[r24]._flag &= ~OBJFLAG_EXTRA;
|
||||
_obj[oPASSAGGIO24]._position = 3;
|
||||
_obj[oMACERIE24]._position = 3;
|
||||
_obj[oDUMMY24]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[oDUMMY24A]._mode |= OBJMODE_OBJSTATUS;
|
||||
} else {
|
||||
read3D("242.3d");
|
||||
Room[r24]._flag |= OBJFLAG_EXTRA;
|
||||
_obj[od24ALLA26]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[oPASSAGGIO24]._position = 4;
|
||||
_obj[oMACERIE24]._position = 4;
|
||||
_obj[oDUMMY24A]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[oDUMMY24]._mode |= OBJMODE_OBJSTATUS;
|
||||
}
|
||||
break;
|
||||
|
||||
case r2A:
|
||||
if (!b) {
|
||||
read3D("2A.3d");
|
||||
Room[r2A]._flag &= ~OBJFLAG_EXTRA;
|
||||
_obj[oDUMMY2A2]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[oDUMMY2A]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
} else {
|
||||
read3D("2A2.3d");
|
||||
Room[r2A]._flag |= OBJFLAG_EXTRA;
|
||||
_obj[oDUMMY2A]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[oDUMMY2A2]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
}
|
||||
break;
|
||||
case r2B:
|
||||
if (!b) {
|
||||
read3D("2B.3d");
|
||||
Room[r2B]._flag &= ~OBJFLAG_EXTRA;
|
||||
_obj[oPORTA2B]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[od2BALLA28]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
} else {
|
||||
read3D("2B2.3d");
|
||||
Room[r2B]._flag |= OBJFLAG_EXTRA;
|
||||
_obj[oPORTA2B]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[od2BALLA28]._mode |= OBJMODE_OBJSTATUS;
|
||||
}
|
||||
break;
|
||||
case r2E:
|
||||
if (!b) {
|
||||
_obj[oCATWALKA2E]._nbox = BACKGROUND;
|
||||
_obj[oCATWALKA2E]._position = 2;
|
||||
_obj[oCATWALKA2E]._anim = a2E2PRIMAPALLONTANANDO;
|
||||
read3D("2E.3d");
|
||||
Room[r2E]._flag &= ~OBJFLAG_EXTRA;
|
||||
_obj[oDUMMY2E]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[oENTRANCE2E]._flag &= ~OBJFLAG_EXAMINE;
|
||||
_obj[oPASSERELLAB2E]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[oCRATERE2E]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[oARBUSTI2E]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[oCREPACCIO2E]._position = 6;
|
||||
} else {
|
||||
_obj[oCATWALKA2E]._position = 3;
|
||||
_obj[oCATWALKA2E]._anim = a2E3PRIMAPAVVICINANDO;
|
||||
read3D("2E2.3d");
|
||||
Room[r2E]._flag |= OBJFLAG_EXTRA;
|
||||
_obj[oDUMMY2E]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[oENTRANCE2E]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[oENTRANCE2E]._flag |= OBJFLAG_EXAMINE;
|
||||
_obj[oPASSERELLAB2E]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[oCRATERE2E]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[oARBUSTI2E]._mode |= OBJMODE_OBJSTATUS;
|
||||
_obj[oCREPACCIO2E]._position = 7;
|
||||
_obj[oCATWALKA2E]._nbox = FOREGROUND;
|
||||
}
|
||||
break;
|
||||
case r2GV:
|
||||
if (!b) {
|
||||
_obj[oVIADOTTO2GV]._position = 7;
|
||||
_obj[oVIADOTTO2GV]._anim = a2G7ATTRAVERSAPONTICELLO;
|
||||
read3D("2GV.3d");
|
||||
Room[r2GV]._flag &= ~OBJFLAG_EXTRA;
|
||||
_obj[oDUMMY2GV]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[oRAGAZZOS2GV]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
_obj[oCOCCODRILLO2GV]._mode &= ~OBJMODE_OBJSTATUS;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
RegenRoom();
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
67
engines/trecision/trecision.cpp
Normal file
67
engines/trecision/trecision.cpp
Normal file
@ -0,0 +1,67 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/scummsys.h"
|
||||
|
||||
#include "common/error.h"
|
||||
#include "common/system.h"
|
||||
#include "graphics/pixelformat.h"
|
||||
#include "engines/util.h"
|
||||
|
||||
#include "trecision/trecision.h"
|
||||
|
||||
#include <common/archive.h>
|
||||
#include <common/config-manager.h>
|
||||
#include <common/fs.h>
|
||||
|
||||
#include "trecision/nl/lib/addtype.h"
|
||||
#include "trecision/nl/sysdef.h"
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
// TODO: Move to main engine?
|
||||
void NlInit();
|
||||
|
||||
TrecisionEngine *g_vm;
|
||||
|
||||
TrecisionEngine::TrecisionEngine(OSystem *syst) : Engine(syst) {
|
||||
const Common::FSNode gameDataDir(ConfMan.get("path"));
|
||||
SearchMan.addSubDirectoryMatching(gameDataDir, "AUTORUN");
|
||||
SearchMan.addSubDirectoryMatching(gameDataDir, "DATA");
|
||||
SearchMan.addSubDirectoryMatching(gameDataDir, "FMV");
|
||||
|
||||
g_vm = this;
|
||||
}
|
||||
|
||||
TrecisionEngine::~TrecisionEngine() {
|
||||
}
|
||||
|
||||
Common::Error TrecisionEngine::run() {
|
||||
const Graphics::PixelFormat kVideoFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); // RGB565
|
||||
initGraphics(MAXX, MAXY, &kVideoFormat);
|
||||
|
||||
NlInit();
|
||||
|
||||
return Common::kNoError;
|
||||
}
|
||||
|
||||
} // End of namespace Trecision
|
42
engines/trecision/trecision.h
Normal file
42
engines/trecision/trecision.h
Normal file
@ -0,0 +1,42 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TRECISION_TRECISION_H
|
||||
#define TRECISION_TRECISION_H
|
||||
|
||||
#include "engines/engine.h"
|
||||
|
||||
namespace Trecision {
|
||||
|
||||
class TrecisionEngine : public Engine {
|
||||
public:
|
||||
TrecisionEngine(OSystem *syst);
|
||||
~TrecisionEngine() override;
|
||||
|
||||
Common::Error run() override;
|
||||
};
|
||||
|
||||
extern TrecisionEngine *g_vm;
|
||||
|
||||
} // End of namespace Trecision
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user