PARALLACTION: Cleanup object initialization

This commit is contained in:
Eugene Sandulenko 2016-05-28 15:21:47 +02:00
parent 829e62a9fe
commit b16c5439b0
19 changed files with 82 additions and 21 deletions

View File

@ -277,6 +277,15 @@ public:
_channels[i].init(this, i);
_isOpen = false;
_opl = NULL;
memset(_voices, 0, sizeof(_voices));
_lastVoice = 0;
_percussionMask = 0;
_adlibTimerProc = NULL;
_adlibTimerParam = NULL;
}
int open();

View File

@ -55,7 +55,7 @@ protected:
}
public:
WrappedLineFormatter(Font *font) : _font(font) { }
WrappedLineFormatter(Font *font) : _font(font), _lines(0), _lineWidth(0) { }
virtual ~WrappedLineFormatter() { }
virtual void calc(const Common::String &text, uint16 maxwidth) {
@ -136,7 +136,7 @@ protected:
}
public:
StringExtent_NS(Font *font) : WrappedLineFormatter(font) { }
StringExtent_NS(Font *font) : WrappedLineFormatter(font), _width(0), _height(0) { }
uint width() const { return _width; }
uint height() const { return _height; }
@ -189,7 +189,8 @@ protected:
}
public:
StringWriter_NS(Parallaction_ns *vm, Font *font) : WrappedLineFormatter(font), _vm(vm) { }
StringWriter_NS(Parallaction_ns *vm, Font *font) : WrappedLineFormatter(font), _vm(vm),
_width(0), _height(0), _color(0), _surf(NULL) { }
void write(const Common::String &text, uint maxWidth, byte color, Graphics::Surface *surf) {
StringExtent_NS se(_font);
@ -464,7 +465,7 @@ protected:
}
public:
StringExtent_BR(Font *font) : WrappedLineFormatter(font) { }
StringExtent_BR(Font *font) : WrappedLineFormatter(font), _width(0), _height(0) { }
uint width() const { return _width; }
uint height() const { return _height; }
@ -480,7 +481,8 @@ class StringWriter_BR : public WrappedLineFormatter {
Graphics::Surface *_surf;
protected:
StringWriter_BR(Font *font, byte color) : WrappedLineFormatter(font) {
StringWriter_BR(Font *font, byte color) : WrappedLineFormatter(font), _width(0), _height(0),
_color(color), _x(0), _y(0), _surf(NULL) {
}
@ -504,7 +506,8 @@ protected:
}
public:
StringWriter_BR(Font *font) : WrappedLineFormatter(font) { }
StringWriter_BR(Font *font) : WrappedLineFormatter(font), _width(0), _height(0),
_color(0), _x(0), _y(0), _surf(NULL) { }
void write(const Common::String &text, uint maxWidth, byte color, Graphics::Surface *surf) {
StringExtent_BR se(_font);

View File

@ -32,6 +32,7 @@ namespace Parallaction {
Debugger::Debugger(Parallaction *vm)
: GUI::Debugger() {
_vm = vm;
_mouseState = MOUSE_ENABLED_SHOW;
registerCmd("continue", WRAP_METHOD(Debugger, cmdExit));
registerCmd("location", WRAP_METHOD(Debugger, Cmd_Location));

View File

@ -140,6 +140,19 @@ DialogueManager::DialogueManager(Parallaction *vm, ZonePtr z) : _vm(vm), _z(z) {
_cmdList = 0;
_answerId = 0;
_faceId = 0;
_q = NULL;
memset(_visAnswers, 0, sizeof(_visAnswers));
_numVisAnswers = 0;
_selection = _oldSelection = 0;
_isKeyDown = false;
_downKey = 0;
_mouseButtons = 0;
}
void DialogueManager::start() {
@ -412,7 +425,8 @@ protected:
}
public:
DialogueManager_ns(Parallaction_ns *vm, ZonePtr z) : DialogueManager(vm, z), _vm(vm) {
DialogueManager_ns(Parallaction_ns *vm, ZonePtr z) : DialogueManager(vm, z), _vm(vm),
_passwordChanged(false), _askPassword(false) {
_ballonPos._questionBalloon = Common::Point(140, 10);
_ballonPos._questionChar = Common::Point(190, 80);
_ballonPos._answerChar = Common::Point(10, 80);

View File

@ -762,14 +762,11 @@ Common::String AmigaDisk_br::selectArchive(const Common::String& name) {
}
Disk_br::Disk_br(Parallaction *vm) : _vm(vm), _baseDir(0) {
Disk_br::Disk_br(Parallaction *vm) : _vm(vm), _baseDir(0), _language(0) {
}
Disk_br::~Disk_br() {
_sset.clear();
}
} // namespace Parallaction

View File

@ -238,7 +238,7 @@ void Disk_ns::setLanguage(uint16 language) {
#pragma mark -
DosDisk_ns::DosDisk_ns(Parallaction* vm) : Disk_ns(vm) {
DosDisk_ns::DosDisk_ns(Parallaction* vm) : Disk_ns(vm), _gfx(NULL) {
}

View File

@ -81,7 +81,7 @@ void ProgramExec::runScripts(ProgramList::iterator first, ProgramList::iterator
return;
}
ProgramExec::ProgramExec() : _modCounter(0) {
ProgramExec::ProgramExec() : _modCounter(0), _instructionNames(NULL) {
}

View File

@ -302,7 +302,7 @@ protected:
}
public:
DosFont(Cnv *cnv) : _data(cnv), _pitch(cnv->_width) {
DosFont(Cnv *cnv) : _data(cnv), _pitch(cnv->_width), _cp(NULL), _bufPitch(0) {
}
~DosFont() {

View File

@ -32,7 +32,8 @@ namespace Parallaction {
GfxObj::GfxObj(uint objType, Frames *frames, const char* name) :
_frames(frames), x(0), y(0), z(0), _prog(0), _flags(0),
type(objType), frame(0), layer(3), scale(100), _hasMask(false), _hasPath(false) {
type(objType), frame(0), layer(3), scale(100), _hasMask(false), _hasPath(false),
transparentKey(0), _maskId(0), _pathId(0) {
if (name) {
_name = strdup(name);

View File

@ -743,6 +743,8 @@ Gfx::Gfx(Parallaction* vm) :
_nextProjectorPos = 0;
_hbCircleRadius = 0;
_overlayMode = false;
_unpackedBitmap = new byte[MAXIMUM_UNPACKED_BITMAP_SIZE];
assert(_unpackedBitmap);

View File

@ -57,7 +57,7 @@ protected:
public:
Font() {}
Font() : _color(0) {}
virtual ~Font() {}
virtual void setColor(byte color) {

View File

@ -43,7 +43,8 @@ protected:
int _fadeSteps;
public:
SplashInputState_BR(Parallaction *vm, const Common::String &name, MenuInputHelper *helper) : MenuInputState(name, helper), _vm(vm) {
SplashInputState_BR(Parallaction *vm, const Common::String &name, MenuInputHelper *helper) : MenuInputState(name, helper), _vm(vm),
_timeOut(0), _startTime(0), _fadeSteps(0) {
}
virtual MenuInputState* run() {
@ -382,6 +383,9 @@ public:
_menuObj->getRect(0, _menuRect);
_cellW = _menuRect.width() / 3;
_cellH = _menuRect.height() / 2;
_menuObjId = _mscMenuObjId = _sfxMenuObjId = 0;
_sfxStatus = _mscStatus = 0;
}
~IngameMenuInputState_BR() {

View File

@ -43,7 +43,8 @@ protected:
Parallaction *_vm;
public:
SplashInputState_NS(Parallaction *vm, const Common::String &name, MenuInputHelper *helper) : MenuInputState(name, helper), _vm(vm) {
SplashInputState_NS(Parallaction *vm, const Common::String &name, MenuInputHelper *helper) : MenuInputState(name, helper), _vm(vm),
_timeOut(0), _startTime(0) {
}
virtual MenuInputState* run() {
@ -298,7 +299,7 @@ class LoadGameInputState_NS : public MenuInputState {
Parallaction *_vm;
public:
LoadGameInputState_NS(Parallaction *vm, MenuInputHelper *helper) : MenuInputState("loadgame", helper), _vm(vm) { }
LoadGameInputState_NS(Parallaction *vm, MenuInputHelper *helper) : MenuInputState("loadgame", helper), _vm(vm), _result(false) { }
virtual MenuInputState* run() {
if (!_result) {
@ -477,6 +478,11 @@ public:
_labels[0] = 0;
_labels[1] = 0;
_fail = false;
_len = 0;
_startTime = 0;
_state = 0;
_codeSelectBlocks[0] = Common::Rect( 111, 129, 127, 153 ); // na
_codeSelectBlocks[1] = Common::Rect( 128, 120, 144, 144 ); // wa
_codeSelectBlocks[2] = Common::Rect( 145, 111, 161, 135 ); // ra
@ -689,6 +695,9 @@ public:
ShowCreditsInputState_NS(Parallaction *vm, MenuInputHelper *helper) : MenuInputState("showcredits", helper), _vm(vm) {
_labels[0] = 0;
_labels[1] = 0;
_current = 0;
_startTime = 0;
}
~ShowCreditsInputState_NS() {
@ -827,6 +836,8 @@ public:
_labels[1] = 0;
_labels[2] = 0;
_labels[3] = 0;
_allPartsComplete = false;
}
void destroyLabels() {

View File

@ -70,6 +70,9 @@ Input::Input(Parallaction *vm) : _vm(vm) {
_mouseButtons = 0;
_delayedActionZone.reset();
_inputMode = 0;
_hasKeyPressEvent = false;
_dinoCursor = 0;
_dougCursor = 0;
_donnaCursor = 0;

View File

@ -145,6 +145,8 @@ Program::Program() {
_locals = new LocalVariable[NUM_LOCALS];
_numLocals = 0;
_status = kProgramIdle;
_ip = 0;
_loopStart = 0;
}
Program::~Program() {
@ -259,6 +261,8 @@ Answer::Answer() {
_noFlags = 0;
_yesFlags = 0;
_hasCounterCondition = false;
_counterValue = 0;
_counterOp = 0;
}
bool Answer::textIsNull() {
@ -298,6 +302,7 @@ Instruction::Instruction() {
// common
_immediate = 0;
_endif = 0;
// BRA specific
_text = 0;

View File

@ -226,6 +226,7 @@ uint16 Script::readLineToken(bool errorOnEOF) {
void Parser::reset() {
_currentOpcodes = 0;
_currentStatements = 0;
_lookup = 0;
_statements.clear();
_opcodes.clear();

View File

@ -405,7 +405,7 @@ protected:
virtual void parseRValue(ScriptVar &var, const char *str);
public:
ProgramParser_br(Parallaction_br *vm) : ProgramParser_ns((Parallaction_ns*)vm), _vm(vm) {
ProgramParser_br(Parallaction_br *vm) : ProgramParser_ns((Parallaction_ns*)vm), _vm(vm), _openIfStatement(0) {
}
virtual void init();

View File

@ -86,7 +86,7 @@ protected:
byte *_trackEnd;
public:
MidiParser_MSC() : byte_11C5A(false) {
MidiParser_MSC() : byte_11C5A(false), _beats(0), _lastEvent(0), _trackEnd(NULL) {
}
};
@ -467,6 +467,11 @@ SoundMan_br::SoundMan_br(Parallaction_br *vm) : _vm(vm) {
_musicEnabled = true;
_sfxEnabled = true;
_sfxLooping = false;
_sfxVolume = 0;
_sfxRate = 0;
_sfxChannel = 0;
}
SoundMan_br::~SoundMan_br() {

View File

@ -323,6 +323,11 @@ void AmigaSoundMan_ns::playLocationMusic(const char *location) {
SoundMan_ns::SoundMan_ns(Parallaction_ns *vm) : _vm(vm) {
_mixer = _vm->_mixer;
_sfxLooping = false;
_sfxVolume = 0;
_sfxRate = 0;
_sfxChannel = 0;
_musicType = 0;
}
void SoundMan_ns::setMusicVolume(int value) {