Skip to content

Commit

Permalink
Merge remote-tracking branch 'sync/master' into prince-malik
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Zbróg committed Nov 11, 2013
2 parents 87e2229 + a45cc2f commit 8cffaaa
Show file tree
Hide file tree
Showing 37 changed files with 445 additions and 455 deletions.
6 changes: 3 additions & 3 deletions engines/cge/cge_main.cpp
Expand Up @@ -1046,7 +1046,7 @@ void CGEEngine::loadSprite(const char *fname, int ref, int scene, int col = 0, i
for (line = sprf.readLine(); !sprf.eos(); line = sprf.readLine()) {
len = line.size();
lcnt++;
strcpy(tmpStr, line.c_str());
Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr));
if (len == 0 || *tmpStr == '.')
continue;

Expand Down Expand Up @@ -1132,7 +1132,7 @@ void CGEEngine::loadSprite(const char *fname, int ref, int scene, int col = 0, i
_sprite->_flags._bDel = true;

// Extract the filename, without the extension
strcpy(_sprite->_file, fname);
Common::strlcpy(_sprite->_file, fname, sizeof(_sprite->_file));
char *p = strchr(_sprite->_file, '.');
if (p)
*p = '\0';
Expand All @@ -1158,7 +1158,7 @@ void CGEEngine::loadScript(const char *fname) {
char *p;

lcnt++;
strcpy(tmpStr, line.c_str());
Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr));
if ((line.size() == 0) || (*tmpStr == '.'))
continue;

Expand Down
5 changes: 2 additions & 3 deletions engines/cge/text.cpp
Expand Up @@ -69,7 +69,7 @@ int16 Text::count() {
for (line = tf.readLine(); !tf.eos(); line = tf.readLine()) {
char *s;
assert(line.size() <= 513);
strcpy(tmpStr, line.c_str());
Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr));
if ((s = strtok(tmpStr, " =,;/\t\n")) == NULL)
continue;
if (!Common::isDigit(*s))
Expand Down Expand Up @@ -101,8 +101,7 @@ void Text::load() {
for (idx = 0, line = tf.readLine(); !tf.eos(); line = tf.readLine()) {
int n = line.size();
char *s;
assert(n <= 513);
strcpy(tmpStr, line.c_str());
Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr));
if ((s = strtok(tmpStr, " =,;/\t\n")) == NULL)
continue;
if (!Common::isDigit(*s))
Expand Down
3 changes: 1 addition & 2 deletions engines/cge/vga13h.cpp
Expand Up @@ -214,8 +214,7 @@ Sprite *Sprite::expand() {

for (line = sprf.readLine(); !sprf.eos(); line = sprf.readLine()) {
len = line.size();
assert(len <= 513);
strcpy(tmpStr, line.c_str());
Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr));
lcnt++;
if (len == 0 || *tmpStr == '.')
continue;
Expand Down
3 changes: 0 additions & 3 deletions engines/dreamweb/dreamweb.h
Expand Up @@ -144,8 +144,6 @@ class DreamWebEngine : public Engine {

bool loadSpeech(const Common::String &filename);

void enableSavingOrLoading(bool enable = true) { _enableSavingOrLoading = enable; }

Common::Language getLanguage() const;
uint8 modifyChar(uint8 c) const;
Common::String modifyFileName(const char *);
Expand All @@ -171,7 +169,6 @@ class DreamWebEngine : public Engine {
uint _speed;
bool _turbo;
uint _oldMouseState;
bool _enableSavingOrLoading;

protected:
GameVars _vars; // saved variables
Expand Down
2 changes: 1 addition & 1 deletion engines/fullpipe/motion.cpp
Expand Up @@ -1146,7 +1146,7 @@ int MovGraph2::findLink(Common::Array<MovGraphLink *> *linkList, int idx, Common
} else if (idx != (int)(linkList->size() - 1)) {
MovGraphLink *lnk = (*linkList)[idx + 1];

if (lnk->_movGraphNode1 == node1 || lnk->_movGraphNode1 == node1) {
if (lnk->_movGraphNode2 == node1 || lnk->_movGraphNode1 == node1) {
node3 = node2;
node2 = node1;
} else if (lnk->_movGraphNode2 == node2 || lnk->_movGraphNode1 == node2) {
Expand Down
2 changes: 1 addition & 1 deletion engines/fullpipe/motion.h
Expand Up @@ -87,7 +87,7 @@ class MctlCompoundArrayItem : public CObject {
int _field_28;

public:
MctlCompoundArrayItem() : _movGraphReactObj(0) {}
MctlCompoundArrayItem() : _movGraphReactObj(0), _motionControllerObj(0), _field_20(0), _field_24(0), _field_28(0) {}
};

class MctlCompoundArray : public Common::Array<MctlCompoundArrayItem *>, public CObject {
Expand Down
3 changes: 3 additions & 0 deletions engines/fullpipe/statics.cpp
Expand Up @@ -1219,6 +1219,9 @@ Movement::Movement(Movement *src, int *oldIdxs, int newSize, StaticANIObject *an
_currDynamicPhaseIndex = 0;
_field_94 = 0;

_field_24 = 0;
_field_28 = 0;

_field_50 = src->_field_50;
_flipFlag = src->_flipFlag;
_currMovement = 0;
Expand Down
4 changes: 3 additions & 1 deletion engines/kyra/chargen.cpp
Expand Up @@ -155,8 +155,10 @@ CharacterGenerator::~CharacterGenerator() {
}

bool CharacterGenerator::start(EoBCharacter *characters, uint8 ***faceShapes) {
if (!characters && !faceShapes)
if (!characters || !faceShapes) {
warning("CharacterGenerator::start: Called without character data");
return true;
}

_characters = characters;
_faceShapes = *faceShapes;
Expand Down
2 changes: 1 addition & 1 deletion engines/kyra/screen_v2.cpp
Expand Up @@ -280,7 +280,7 @@ void Screen_v2::setTextColorMap(const uint8 *cmap) {
void Screen_v2::wsaFrameAnimationStep(int x1, int y1, int x2, int y2,
int w1, int h1, int w2, int h2, int srcPage, int dstPage, int dim) {

if (!(w1 || h1 || w2 || h2))
if (!w1 || !h1 || !w2 || !h2)
return;

ScreenDim cdm = *getScreenDim(dim);
Expand Down
1 change: 1 addition & 0 deletions engines/kyra/sound_towns.cpp
Expand Up @@ -225,6 +225,7 @@ void SoundTowns::playSoundEffect(uint8 track, uint8) {
_driver->chanPanPos(_sfxChannel, 0x40);
_driver->chanPitch(_sfxChannel, 0);
_driver->playSoundEffect(_sfxChannel, note, 127, sfxPlaybackBuffer);
delete[] sfxPlaybackBuffer;
}

void SoundTowns::updateVolumeSettings() {
Expand Down
2 changes: 0 additions & 2 deletions engines/mortevielle/mouse.cpp
Expand Up @@ -38,9 +38,7 @@ namespace Mortevielle {
* @remarks Originally called 'init_mouse'
*/
void MouseHandler::initMouse() {
_counter = 0;
_pos = Common::Point(0, 0);

_vm->setMouseClick(false);
}

Expand Down
2 changes: 0 additions & 2 deletions engines/mortevielle/mouse.h
Expand Up @@ -36,8 +36,6 @@ class MortevielleEngine;
class MouseHandler {
private:
MortevielleEngine *_vm;

int _counter;
public:
Common::Point _pos;

Expand Down
2 changes: 1 addition & 1 deletion engines/tsage/blue_force/blueforce_scenes4.h
Expand Up @@ -119,7 +119,7 @@ class Scene410: public SceneExt {
int _action1Count, _talkCount, _field1FBA;
int _cuffedDriverFl, _field1FBE;
int _field1FC0;
int _field1FC2, _harrisonMovedFl;
int _field1FC2, _harrisonMovedFl;

Scene410();
virtual void postInit(SceneObjectList *OwnerList = NULL);
Expand Down
22 changes: 11 additions & 11 deletions engines/tsage/converse.cpp
Expand Up @@ -727,10 +727,10 @@ void StripManager::synchronize(Serializer &s) {
}

void StripManager::remove() {
if (g_vm->getGameID() == GType_Ringworld2) {
if (g_vm->getGameID() == GType_Ringworld2) {
for (uint i = 0; i < _speakerList.size(); ++i) {
if (_activeSpeaker != _speakerList[i])
_speakerList[i]->proc16();
_speakerList[i]->stopSpeaking();
}
}

Expand All @@ -741,7 +741,7 @@ void StripManager::remove() {
}

if (_activeSpeaker) {
if (g_vm->getGameID() == GType_Ringworld2)
if (g_vm->getGameID() == GType_Ringworld2)
static_cast<Ringworld2::VisualSpeaker *>(_activeSpeaker)->_speakerMode = 0xff;
_activeSpeaker->remove();
}
Expand Down Expand Up @@ -822,7 +822,7 @@ void StripManager::signal() {
break;
}
}

_field2E8 = obj44._id;
Common::StringArray choiceList;

Expand All @@ -836,7 +836,7 @@ void StripManager::signal() {
int f16Index = _lookupList[obj44._field16[0] - 1];
int entryId = obj44._field16[f16Index];

Obj0A &entry = obj44._list[idx];
Obj0A &entry = obj44._list[idx];
if (entry._id == entryId) {
// Get the next one
choiceList.push_back((const char *)&_script[0] + entry._scriptOffset);
Expand Down Expand Up @@ -864,15 +864,15 @@ void StripManager::signal() {

// Get the next one
const char *choiceStr = (const char *)&_script[0] + obj44._list[idx]._scriptOffset;

if (!*choiceStr) {
// Choice is empty
assert(g_vm->getGameID() == GType_Ringworld2);

if (obj44._list[1]._id) {
// it's a reference to another list slot
int listId = obj44._list[idx]._id;

int obj44Idx = 0;
while (_obj44List[obj44Idx]._id != listId)
++obj44Idx;
Expand All @@ -882,7 +882,7 @@ void StripManager::signal() {
// seems to be set to the R2_GLOBALS._stripManager_lookupList, so manually set it
if (!_lookupList)
_lookupList = R2_GLOBALS._stripManager_lookupList;

int f16Index = _lookupList[_obj44List[obj44Idx]._field16[0] - 1];
listId = _obj44List[obj44Idx]._field16[f16Index];

Expand Down Expand Up @@ -948,11 +948,11 @@ void StripManager::signal() {

if (g_vm->getGameID() == GType_Ringworld2) {
Ringworld2::VisualSpeaker *speaker = static_cast<Ringworld2::VisualSpeaker *>(_activeSpeaker);

if (speaker) {
speaker->_speakerMode = obj44._speakerMode;
if (!choiceList[strIndex].empty())
speaker->proc15();
speaker->animateSpeaker();
}

if (!choiceList[strIndex].empty()) {
Expand All @@ -962,7 +962,7 @@ void StripManager::signal() {
_delayFrames = 1;
} else {
_delayFrames = 0;
speaker->proc15();
speaker->animateSpeaker();
}
} else {
_textShown = true;
Expand Down
2 changes: 1 addition & 1 deletion engines/tsage/converse.h
Expand Up @@ -94,7 +94,7 @@ class Speaker : public EventHandler {
virtual void startSpeaking(Action *action);
virtual void setText(const Common::String &msg);
virtual void removeText();
virtual void proc16() {}
virtual void stopSpeaking() {}

void setTextPos(const Common::Point &pt) { _textPos = pt; }
};
Expand Down
14 changes: 7 additions & 7 deletions engines/tsage/core.cpp
Expand Up @@ -1800,7 +1800,7 @@ void SceneItem::display(int resNum, int lineNum, ...) {
g_globals->_sceneText.remove();
}

if ((g_vm->getGameID() != GType_Ringworld) && (g_vm->getGameID() != GType_Ringworld2)
if ((g_vm->getGameID() != GType_Ringworld) && (g_vm->getGameID() != GType_Ringworld2)
&& T2_GLOBALS._uiElements._active) {
// Show user interface
T2_GLOBALS._uiElements.show();
Expand Down Expand Up @@ -2511,7 +2511,7 @@ void SceneObject::postInit(SceneObjectList *OwnerList) {
if (!OwnerList)
OwnerList = g_globals->_sceneObjects;

bool isExisting = OwnerList->contains(this);
bool isExisting = OwnerList->contains(this);
if (!isExisting || ((_flags & OBJFLAG_REMOVE) != 0)) {
_percent = 100;
_priority = 255;
Expand Down Expand Up @@ -2708,7 +2708,7 @@ GfxSurface SceneObject::getFrame() {
Graphics::Surface s = frame.lockSurface();
byte *p = (byte *)s.getPixels();
byte *endP = p + s.w * s.h;

while (p < endP) {
if (*p != frame._transColor)
*p = R2_GLOBALS._fadePaletteMap[_shade - 1][*p];
Expand Down Expand Up @@ -2742,8 +2742,8 @@ void SceneObject::draw() {
switch (_effect) {
case EFFECT_SHADOW_MAP: {
assert(_shadowMap);
GLOBALS.gfxManager().getSurface().copyFrom(frame, frame.getBounds(),

GLOBALS.gfxManager().getSurface().copyFrom(frame, frame.getBounds(),
destRect, priorityRegion, _shadowMap);
return;
}
Expand Down Expand Up @@ -2859,7 +2859,7 @@ void BackgroundSceneObject::setup2(int visage, int stripFrameNum, int frameNum,
void BackgroundSceneObject::copySceneToBackground() {
GLOBALS._sceneManager._scene->_backSurface.copyFrom(g_globals->gfxManager().getSurface(), 0, 0);

// WORKAROUND: Since savegames don't store the active screen data, once we copy the
// WORKAROUND: Since savegames don't store the active screen data, once we copy the
// foreground objects to the background, we have to prevent the scene being saved.
if (g_vm->getGameID() == GType_Ringworld2)
((Ringworld2::SceneExt *)GLOBALS._sceneManager._scene)->_preventSaving = true;
Expand Down Expand Up @@ -4346,7 +4346,7 @@ void SceneHandler::process(Event &event) {
// Scan the item list to find one the mouse is within
SynchronizedList<SceneItem *>::iterator i;
for (i = g_globals->_sceneItems.begin(); i != g_globals->_sceneItems.end(); ++i) {
SceneItem *item = *i;
SceneItem *item = *i;
if (item->contains(event.mousePos)) {
// Pass the action to the item
bool handled = item->startAction(g_globals->_events.getCursor(), event);
Expand Down

0 comments on commit 8cffaaa

Please sign in to comment.