WINTERMUTE: Rename FuncName/VarName -> funcName/varName in BSprite

This commit is contained in:
Einar Johan Trøan Sømåen 2012-07-08 22:10:15 +02:00
parent 11e60e35a2
commit 5f7b45de34
12 changed files with 99 additions and 94 deletions

View File

@ -620,7 +620,7 @@ HRESULT CAdActor::update() {
}
if (_tempSprite2) {
_tempSprite2->Reset();
_tempSprite2->reset();
if (_tempSprite2->_looping) _tempSprite2->_looping = false;
}
_currentSprite = _tempSprite2;
@ -649,7 +649,7 @@ HRESULT CAdActor::update() {
}
if (_tempSprite2) {
_tempSprite2->Reset();
_tempSprite2->reset();
if (_tempSprite2->_looping) _tempSprite2->_looping = false;
}
_currentSprite = _tempSprite2;
@ -694,7 +694,7 @@ HRESULT CAdActor::update() {
} else {
_tempSprite2 = getTalkStance(_sentence->getNextStance());
if (_tempSprite2) {
_tempSprite2->Reset();
_tempSprite2->reset();
_currentSprite = _tempSprite2;
((CAdGame *)Game)->addSentence(_sentence);
}
@ -1304,7 +1304,7 @@ HRESULT CAdActor::playAnim(const char *filename) {
if (Anim) {
_animSprite2 = Anim->getSprite(_dir);
if (_animSprite2) {
_animSprite2->Reset();
_animSprite2->reset();
_state = STATE_PLAYING_ANIM_SET;
return S_OK;
}

View File

@ -574,7 +574,7 @@ HRESULT CAdEntity::update() {
} else {
_tempSprite2 = getTalkStance(_sentence->getNextStance());
if (_tempSprite2) {
_tempSprite2->Reset();
_tempSprite2->reset();
_currentSprite = _tempSprite2;
}
((CAdGame *)Game)->addSentence(_sentence);

View File

@ -366,7 +366,7 @@ HRESULT CAdItem::update() {
} else {
_tempSprite2 = getTalkStance(_sentence->getNextStance());
if (_tempSprite2) {
_tempSprite2->Reset();
_tempSprite2->reset();
_currentSprite = _tempSprite2;
}
((CAdGame *)Game)->addSentence(_sentence);
@ -398,7 +398,8 @@ HRESULT CAdItem::display(int x, int y) {
_posY = y;
HRESULT ret;
if (_currentSprite) ret = _currentSprite->Draw(x, y, this, 100, 100, _alphaColor);
if (_currentSprite)
ret = _currentSprite->draw(x, y, this, 100, 100, _alphaColor);
else ret = S_OK;
if (_displayAmount) {

View File

@ -288,7 +288,7 @@ HRESULT CAdSentence::update(TDirection dir) {
talkNodeFound = true;
CBSprite *newSprite = _talkDef->_nodes[i]->getSprite(dir);
if (newSprite != _currentSprite) newSprite->Reset();
if (newSprite != _currentSprite) newSprite->reset();
_currentSprite = newSprite;
if (!_talkDef->_nodes[i]->_playToEnd) break;
@ -300,7 +300,7 @@ HRESULT CAdSentence::update(TDirection dir) {
if (!talkNodeFound) {
CBSprite *newSprite = _talkDef->getDefaultSprite(dir);
if (newSprite) {
if (newSprite != _currentSprite) newSprite->Reset();
if (newSprite != _currentSprite) newSprite->reset();
_currentSprite = newSprite;
} else _currentSprite = NULL;
}

View File

@ -4245,10 +4245,10 @@ HRESULT CBGame::stopVideo() {
HRESULT CBGame::drawCursor(CBSprite *cursor) {
if (!cursor) return E_FAIL;
if (cursor != _lastCursor) {
cursor->Reset();
cursor->reset();
_lastCursor = cursor;
}
return cursor->Draw(_mousePos.x, _mousePos.y);
return cursor->draw(_mousePos.x, _mousePos.y);
}

View File

@ -51,7 +51,7 @@ IMPLEMENT_PERSISTENT(CBSprite, false)
CBSprite::CBSprite(CBGame *inGame, CBObject *Owner): CBScriptHolder(inGame) {
_editorAllFrames = false;
_owner = Owner;
SetDefaults();
setDefaults();
}
@ -62,7 +62,7 @@ CBSprite::~CBSprite() {
//////////////////////////////////////////////////////////////////////////
void CBSprite::SetDefaults() {
void CBSprite::setDefaults() {
_currentFrame = -1;
_looping = false;
_lastFrameTime = 0;
@ -97,13 +97,13 @@ void CBSprite::cleanup() {
delete[] _editorBgFile;
_editorBgFile = NULL;
SetDefaults();
setDefaults();
}
//////////////////////////////////////////////////////////////////////////
HRESULT CBSprite::Draw(int X, int Y, CBObject *Register, float ZoomX, float ZoomY, uint32 Alpha) {
GetCurrentFrame(ZoomX, ZoomY);
HRESULT CBSprite::draw(int x, int y, CBObject *registerOwner, float zoomX, float zoomY, uint32 alpha) {
GetCurrentFrame(zoomX, zoomY);
if (_currentFrame < 0 || _currentFrame >= _frames.GetSize()) return S_OK;
// move owner if allowed to
@ -112,25 +112,25 @@ HRESULT CBSprite::Draw(int X, int Y, CBObject *Register, float ZoomX, float Zoom
_owner->_posY += _moveY;
_owner->afterMove();
X = _owner->_posX;
Y = _owner->_posY;
x = _owner->_posX;
y = _owner->_posY;
}
// draw frame
return display(X, Y, Register, ZoomX, ZoomY, Alpha);
return display(x, y, registerOwner, zoomX, zoomY, alpha);
}
//////////////////////////////////////////////////////////////////////
HRESULT CBSprite::loadFile(const char *filename, int LifeTime, TSpriteCacheType CacheType) {
Common::SeekableReadStream *File = Game->_fileManager->openFile(filename);
if (!File) {
HRESULT CBSprite::loadFile(const char *filename, int lifeTime, TSpriteCacheType cacheType) {
Common::SeekableReadStream *file = Game->_fileManager->openFile(filename);
if (!file) {
Game->LOG(0, "CBSprite::LoadFile failed for file '%s'", filename);
if (Game->_dEBUG_DebugMode) return loadFile("invalid_debug.bmp", LifeTime, CacheType);
else return loadFile("invalid.bmp", LifeTime, CacheType);
if (Game->_dEBUG_DebugMode) return loadFile("invalid_debug.bmp", lifeTime, cacheType);
else return loadFile("invalid.bmp", lifeTime, cacheType);
} else {
Game->_fileManager->closeFile(File);
File = NULL;
Game->_fileManager->closeFile(file);
file = NULL;
}
HRESULT ret;
@ -139,7 +139,7 @@ HRESULT CBSprite::loadFile(const char *filename, int LifeTime, TSpriteCacheType
if (StringUtil::startsWith(filename, "savegame:", true) || StringUtil::compareNoCase(ext, "bmp") || StringUtil::compareNoCase(ext, "tga") || StringUtil::compareNoCase(ext, "png") || StringUtil::compareNoCase(ext, "jpg")) {
CBFrame *frame = new CBFrame(Game);
CBSubFrame *subframe = new CBSubFrame(Game);
subframe->setSurface(filename, true, 0, 0, 0, LifeTime, true);
subframe->setSurface(filename, true, 0, 0, 0, lifeTime, true);
if (subframe->_surface == NULL) {
Game->LOG(0, "Error loading simple sprite '%s'", filename);
ret = E_FAIL;
@ -155,7 +155,7 @@ HRESULT CBSprite::loadFile(const char *filename, int LifeTime, TSpriteCacheType
} else {
byte *buffer = Game->_fileManager->readWholeFile(filename);
if (buffer) {
if (FAILED(ret = loadBuffer(buffer, true, LifeTime, CacheType))) Game->LOG(0, "Error parsing SPRITE file '%s'", filename);
if (FAILED(ret = loadBuffer(buffer, true, lifeTime, cacheType))) Game->LOG(0, "Error parsing SPRITE file '%s'", filename);
delete [] buffer;
}
}
@ -221,7 +221,7 @@ HRESULT CBSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC
buffer = params;
}
int frame_count = 1;
int frameCount = 1;
CBFrame *frame;
while ((cmd = parser.getCommand((char **)&buffer, commands, (char **)&params)) > 0) {
switch (cmd) {
@ -285,18 +285,18 @@ HRESULT CBSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC
case TOKEN_FRAME: {
int FrameLifeTime = lifeTime;
if (cacheType == CACHE_HALF && frame_count % 2 != 1) FrameLifeTime = -1;
if (cacheType == CACHE_HALF && frameCount % 2 != 1) FrameLifeTime = -1;
frame = new CBFrame(Game);
if (FAILED(frame->loadBuffer(params, FrameLifeTime, _streamedKeepLoaded))) {
delete frame;
Game->LOG(0, "Error parsing frame %d", frame_count);
Game->LOG(0, "Error parsing frame %d", frameCount);
return E_FAIL;
}
_frames.Add(frame);
frame_count++;
frameCount++;
if (_currentFrame == -1) _currentFrame = 0;
}
break;
@ -318,11 +318,11 @@ HRESULT CBSprite::loadBuffer(byte *buffer, bool complete, int lifeTime, TSpriteC
//////////////////////////////////////////////////////////////////////
void CBSprite::Reset() {
void CBSprite::reset() {
if (_frames.GetSize() > 0) _currentFrame = 0;
else _currentFrame = -1;
KillAllSounds();
killAllSounds();
_lastFrameTime = 0;
_finished = false;
@ -331,7 +331,7 @@ void CBSprite::Reset() {
//////////////////////////////////////////////////////////////////////
bool CBSprite::GetCurrentFrame(float ZoomX, float ZoomY) {
bool CBSprite::GetCurrentFrame(float zoomX, float zoomY) {
//if(_owner && _owner->_freezable && Game->_state == GAME_FROZEN) return true;
if (_currentFrame == -1) return false;
@ -340,7 +340,7 @@ bool CBSprite::GetCurrentFrame(float ZoomX, float ZoomY) {
if (_owner && _owner->_freezable) timer = Game->_timer;
else timer = Game->_liveTimer;
int LastFrame = _currentFrame;
int lastFrame = _currentFrame;
// get current frame
if (!_paused && !_finished && timer >= _lastFrameTime + _frames[_currentFrame]->_delay && _lastFrameTime != 0) {
@ -360,7 +360,7 @@ bool CBSprite::GetCurrentFrame(float ZoomX, float ZoomY) {
_lastFrameTime = timer;
}
_changed = (LastFrame != _currentFrame || (_looping && _frames.GetSize() == 1));
_changed = (lastFrame != _currentFrame || (_looping && _frames.GetSize() == 1));
if (_lastFrameTime == 0) {
_lastFrameTime = timer;
@ -372,9 +372,9 @@ bool CBSprite::GetCurrentFrame(float ZoomX, float ZoomY) {
_moveX = _frames[_currentFrame]->_moveX;
_moveY = _frames[_currentFrame]->_moveY;
if (ZoomX != 100 || ZoomY != 100) {
_moveX = (int)((float)_moveX * (float)(ZoomX / 100.0f));
_moveY = (int)((float)_moveY * (float)(ZoomY / 100.0f));
if (zoomX != 100 || zoomY != 100) {
_moveX = (int)((float)_moveX * (float)(zoomX / 100.0f));
_moveY = (int)((float)_moveY * (float)(zoomY / 100.0f));
}
}
@ -389,7 +389,7 @@ HRESULT CBSprite::display(int X, int Y, CBObject *Register, float ZoomX, float Z
// on change...
if (_changed) {
if (_frames[_currentFrame]->_killSound) {
KillAllSounds();
killAllSounds();
}
applyEvent("FrameChanged");
_frames[_currentFrame]->oneTimeDisplay(_owner, Game->_editorMode && _editorMuted);
@ -401,7 +401,7 @@ HRESULT CBSprite::display(int X, int Y, CBObject *Register, float ZoomX, float Z
//////////////////////////////////////////////////////////////////////////
CBSurface *CBSprite::GetSurface() {
CBSurface *CBSprite::getSurface() {
// only used for animated textures for 3D models
if (_currentFrame < 0 || _currentFrame >= _frames.GetSize()) return NULL;
CBFrame *Frame = _frames[_currentFrame];
@ -413,16 +413,16 @@ CBSurface *CBSprite::GetSurface() {
}
//////////////////////////////////////////////////////////////////////////
bool CBSprite::GetBoundingRect(LPRECT Rect, int X, int Y, float ScaleX, float ScaleY) {
if (!Rect) return false;
bool CBSprite::GetBoundingRect(LPRECT rect, int x, int y, float scaleX, float scaleY) {
if (!rect) return false;
CBPlatform::SetRectEmpty(Rect);
CBPlatform::SetRectEmpty(rect);
for (int i = 0; i < _frames.GetSize(); i++) {
RECT frame;
RECT temp;
CBPlatform::CopyRect(&temp, Rect);
_frames[i]->getBoundingRect(&frame, X, Y, ScaleX, ScaleY);
CBPlatform::UnionRect(Rect, &temp, &frame);
CBPlatform::CopyRect(&temp, rect);
_frames[i]->getBoundingRect(&frame, x, y, scaleX, scaleY);
CBPlatform::UnionRect(rect, &temp, &frame);
}
return true;
}
@ -552,7 +552,7 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "Reset") == 0) {
stack->correctParams(0);
Reset();
reset();
stack->pushNULL();
return S_OK;
}
@ -562,21 +562,21 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "AddFrame") == 0) {
stack->correctParams(1);
CScValue *Val = stack->pop();
CScValue *val = stack->pop();
const char *filename = NULL;
if (!Val->isNULL()) filename = Val->getString();
if (!val->isNULL()) filename = val->getString();
CBFrame *Frame = new CBFrame(Game);
CBFrame *frame = new CBFrame(Game);
if (filename != NULL) {
CBSubFrame *Sub = new CBSubFrame(Game);
if (SUCCEEDED(Sub->setSurface(filename))) {
Sub->setDefaultRect();
Frame->_subframes.Add(Sub);
} else delete Sub;
CBSubFrame *sub = new CBSubFrame(Game);
if (SUCCEEDED(sub->setSurface(filename))) {
sub->setDefaultRect();
frame->_subframes.Add(sub);
} else delete sub;
}
_frames.Add(Frame);
_frames.Add(frame);
stack->pushNative(Frame, true);
stack->pushNative(frame, true);
return S_OK;
}
@ -585,24 +585,27 @@ HRESULT CBSprite::scCallMethod(CScScript *script, CScStack *stack, CScStack *thi
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "InsertFrame") == 0) {
stack->correctParams(2);
int Index = stack->pop()->getInt();
if (Index < 0) Index = 0;
int index = stack->pop()->getInt();
if (index < 0)
index = 0;
CScValue *Val = stack->pop();
CScValue *val = stack->pop();
const char *filename = NULL;
if (!Val->isNULL()) filename = Val->getString();
if (!val->isNULL())
filename = val->getString();
CBFrame *Frame = new CBFrame(Game);
CBFrame *frame = new CBFrame(Game);
if (filename != NULL) {
CBSubFrame *Sub = new CBSubFrame(Game);
if (SUCCEEDED(Sub->setSurface(filename))) Frame->_subframes.Add(Sub);
else delete Sub;
CBSubFrame *sub = new CBSubFrame(Game);
if (SUCCEEDED(sub->setSurface(filename))) frame->_subframes.Add(sub);
else delete sub;
}
if (Index >= _frames.GetSize()) _frames.Add(Frame);
else _frames.InsertAt(Index, Frame);
if (index >= _frames.GetSize())
_frames.Add(frame);
else _frames.InsertAt(index, frame);
stack->pushNative(Frame, true);
stack->pushNative(frame, true);
return S_OK;
}
@ -744,9 +747,10 @@ const char *CBSprite::scToString() {
//////////////////////////////////////////////////////////////////////////
HRESULT CBSprite::KillAllSounds() {
HRESULT CBSprite::killAllSounds() {
for (int i = 0; i < _frames.GetSize(); i++) {
if (_frames[i]->_sound) _frames[i]->_sound->stop();
if (_frames[i]->_sound)
_frames[i]->_sound->stop();
}
return S_OK;
}

View File

@ -39,8 +39,8 @@ class CBSurface;
class CBObject;
class CBSprite: public CBScriptHolder {
public:
HRESULT KillAllSounds();
CBSurface *GetSurface();
HRESULT killAllSounds();
CBSurface *getSurface();
char *_editorBgFile;
int _editorBgOffsetX;
int _editorBgOffsetY;
@ -48,32 +48,32 @@ public:
bool _streamed;
bool _streamedKeepLoaded;
void cleanup();
void SetDefaults();
void setDefaults();
bool _precise;
DECLARE_PERSISTENT(CBSprite, CBScriptHolder)
bool _editorAllFrames;
bool GetBoundingRect(LPRECT Rect, int X, int Y, float ScaleX = 100, float ScaleY = 100);
bool GetBoundingRect(LPRECT rect, int x, int y, float scaleX = 100, float scaleY = 100);
int _moveY;
int _moveX;
HRESULT display(int X, int Y, CBObject *Register = NULL, float ZoomX = 100, float ZoomY = 100, uint32 Alpha = 0xFFFFFFFF, float Rotate = 0.0f, TSpriteBlendMode BlendMode = BLEND_NORMAL);
bool GetCurrentFrame(float ZoomX = 100, float ZoomY = 100);
HRESULT display(int x, int y, CBObject *registerOwner = NULL, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL);
bool GetCurrentFrame(float zoomX = 100, float zoomY = 100);
bool _canBreak;
bool _editorMuted;
bool _continuous;
void Reset();
void reset();
CBObject *_owner;
bool _changed;
bool _paused;
bool _finished;
HRESULT loadBuffer(byte *Buffer, bool Compete = true, int LifeTime = -1, TSpriteCacheType CacheType = CACHE_ALL);
HRESULT loadFile(const char *filename, int LifeTime = -1, TSpriteCacheType CacheType = CACHE_ALL);
HRESULT loadBuffer(byte *buffer, bool compete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
HRESULT loadFile(const char *filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL);
uint32 _lastFrameTime;
HRESULT Draw(int X, int Y, CBObject *Register = NULL, float ZoomX = 100, float ZoomY = 100, uint32 Alpha = 0xFFFFFFFF);
HRESULT draw(int x, int y, CBObject *Register = NULL, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF);
bool _looping;
int _currentFrame;
HRESULT AddFrame(const char *filename, uint32 Delay = 0, int HotspotX = 0, int HotspotY = 0, RECT *Rect = NULL);
CBSprite(CBGame *inGame, CBObject *Owner = NULL);
HRESULT addFrame(const char *filename, uint32 delay = 0, int hotspotX = 0, int hotspotY = 0, RECT *rect = NULL);
CBSprite(CBGame *inGame, CBObject *owner = NULL);
virtual ~CBSprite();
CBArray<CBFrame *, CBFrame *> _frames;
HRESULT saveAsText(CBDynBuffer *buffer, int indent);

View File

@ -74,7 +74,7 @@ CPartParticle::~CPartParticle(void) {
//////////////////////////////////////////////////////////////////////////
HRESULT CPartParticle::setSprite(const char *filename) {
if (_sprite && _sprite->_filename && scumm_stricmp(filename, _sprite->_filename) == 0) {
_sprite->Reset();
_sprite->reset();
return S_OK;
}

View File

@ -631,7 +631,7 @@ HRESULT CUIButton::display(int OffsetX, int OffsetY) {
if (back) back->display(OffsetX + _posX, OffsetY + _posY, _width, _height);
//if(image) image->Draw(ImageX +((_press||_oneTimePress)&&back?1:0), ImageY +((_press||_oneTimePress)&&back?1:0), NULL);
if (image) image->Draw(ImageX + ((_press || _oneTimePress) && back ? 1 : 0), ImageY + ((_press || _oneTimePress) && back ? 1 : 0), _pixelPerfect ? this : NULL);
if (image) image->draw(ImageX + ((_press || _oneTimePress) && back ? 1 : 0), ImageY + ((_press || _oneTimePress) && back ? 1 : 0), _pixelPerfect ? this : NULL);
if (font && _text) {
int text_offset = (_height - font->getTextHeight((byte *)_text, _width)) / 2;
@ -641,11 +641,11 @@ HRESULT CUIButton::display(int OffsetX, int OffsetY) {
if (!_pixelPerfect || !_image) Game->_renderer->_rectList.Add(new CBActiveRect(Game, this, NULL, OffsetX + _posX, OffsetY + _posY, _width, _height, 100, 100, false));
// reset unused sprites
if (_image && _image != image) _image->Reset();
if (_imageDisable && _imageDisable != image) _imageDisable->Reset();
if (_imageFocus && _imageFocus != image) _imageFocus->Reset();
if (_imagePress && _imagePress != image) _imagePress->Reset();
if (_imageHover && _imageHover != image) _imageHover->Reset();
if (_image && _image != image) _image->reset();
if (_imageDisable && _imageDisable != image) _imageDisable->reset();
if (_imageFocus && _imageFocus != image) _imageFocus->reset();
if (_imagePress && _imagePress != image) _imagePress->reset();
if (_imageHover && _imageHover != image) _imageHover->reset();
_press = _hover && Game->_mouseLeftDown && Game->_capturedObject == this;

View File

@ -552,7 +552,7 @@ HRESULT CUIEdit::display(int OffsetX, int OffsetY) {
Game->_textEncoding = TEXT_ANSI;
if (_back) _back->display(OffsetX + _posX, OffsetY + _posY, _width, _height);
if (_image) _image->Draw(OffsetX + _posX, OffsetY + _posY, NULL);
if (_image) _image->draw(OffsetX + _posX, OffsetY + _posY, NULL);
// prepare fonts
CBFont *font;

View File

@ -70,7 +70,7 @@ HRESULT CUIText::display(int OffsetX, int OffsetY) {
if (!font) font = Game->_systemFont;
if (_back) _back->display(OffsetX + _posX, OffsetY + _posY, _width, _height);
if (_image) _image->Draw(OffsetX + _posX, OffsetY + _posY, NULL);
if (_image) _image->draw(OffsetX + _posX, OffsetY + _posY, NULL);
if (font && _text) {
int text_offset;

View File

@ -179,7 +179,7 @@ HRESULT CUIWindow::display(int OffsetX, int OffsetY) {
if (_alphaColor != 0) Game->_renderer->_forceAlphaColor = _alphaColor;
if (back) back->display(_posX + OffsetX, _posY + OffsetY, _width, _height);
if (image) image->Draw(_posX + OffsetX, _posY + OffsetY, _transparent ? NULL : this);
if (image) image->draw(_posX + OffsetX, _posY + OffsetY, _transparent ? NULL : this);
if (!CBPlatform::IsRectEmpty(&_titleRect) && font && _text) {
font->drawText((byte *)_text, _posX + OffsetX + _titleRect.left, _posY + OffsetY + _titleRect.top, _titleRect.right - _titleRect.left, _titleAlign, _titleRect.bottom - _titleRect.top);