[Scummvm-git-logs] scummvm master -> 816a1a9da39ba1af2fe38ae2184cb5bfdc393376
dreammaster
paulfgilbert at gmail.com
Tue Feb 18 03:51:08 UTC 2020
This automated email contains information about 11 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
ae63fd92f6 ULTIMA8: Converting widget folder class fields
3dbee986c0 ULTIMA8: Renaming world folder class fields
3c320a414a ULTIMA8: Renaming more world folder class fields
2b934e06ab ULTIMA8: Renaming more world folder class fields
45d0d46675 ULTIMA8: Refactoring more world folder class fields
e08bd88ce1 ULTIMA8: Renaming actors folder class fields
de6256ed58 ULTIMA8: Renaming actors folder class fields
9c22eba283 ULTIMA8: Renaming actors folder class fields
b67a6456de ULTIMA8: Renaming audio class fields
a18ebbb635 ULTIMA8: Renaming font classes fields
816a1a9da3 ULTIMA8: Renaming font classes fields
Commit: ae63fd92f6645c90d9aa1a23626109b53c953b79
https://github.com/scummvm/scummvm/commit/ae63fd92f6645c90d9aa1a23626109b53c953b79
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-17T19:42:20-08:00
Commit Message:
ULTIMA8: Converting widget folder class fields
Changed paths:
engines/ultima/ultima8/gumps/bark_gump.cpp
engines/ultima/ultima8/gumps/widgets/button_widget.cpp
engines/ultima/ultima8/gumps/widgets/button_widget.h
engines/ultima/ultima8/gumps/widgets/edit_widget.cpp
engines/ultima/ultima8/gumps/widgets/edit_widget.h
engines/ultima/ultima8/gumps/widgets/game_widget.cpp
engines/ultima/ultima8/gumps/widgets/game_widget.h
engines/ultima/ultima8/gumps/widgets/text_widget.cpp
engines/ultima/ultima8/gumps/widgets/text_widget.h
diff --git a/engines/ultima/ultima8/gumps/bark_gump.cpp b/engines/ultima/ultima8/gumps/bark_gump.cpp
index 6ba91cd..d673101 100644
--- a/engines/ultima/ultima8/gumps/bark_gump.cpp
+++ b/engines/ultima/ultima8/gumps/bark_gump.cpp
@@ -37,7 +37,8 @@ DEFINE_RUNTIME_CLASSTYPE_CODE(BarkGump, ItemRelativeGump)
// TODO: Remove all the hacks
-BarkGump::BarkGump() : ItemRelativeGump() {
+BarkGump::BarkGump() : ItemRelativeGump(), _counter(0), _textWidget(0),
+ _speechShapeNum(0), _speechLength(0), _totalTextHeight(0) {
}
BarkGump::BarkGump(uint16 owner, const Std::string &msg, uint32 speechShapeNum) :
diff --git a/engines/ultima/ultima8/gumps/widgets/button_widget.cpp b/engines/ultima/ultima8/gumps/widgets/button_widget.cpp
index 7bde38b..9d564d9 100644
--- a/engines/ultima/ultima8/gumps/widgets/button_widget.cpp
+++ b/engines/ultima/ultima8/gumps/widgets/button_widget.cpp
@@ -29,7 +29,6 @@
#include "ultima/ultima8/graphics/shape.h"
#include "ultima/ultima8/kernel/mouse.h"
#include "ultima/ultima8/world/get_object.h"
-
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/filesys/odata_source.h"
@@ -39,28 +38,28 @@ namespace Ultima8 {
// p_dynamic_class stuff
DEFINE_RUNTIME_CLASSTYPE_CODE(ButtonWidget, Gump)
-ButtonWidget::ButtonWidget()
- : Gump() {
+ButtonWidget::ButtonWidget() : Gump(), _shapeUp(0), _shapeDown(0), _mouseOver(false),
+ _origW(0), _origH(0) {
}
ButtonWidget::ButtonWidget(int x, int y, Std::string txt, bool gamefont,
- int font, uint32 mouseOverBlendCol_,
- int w, int h, int32 layer_) :
- Gump(x, y, w, h, 0, 0, layer_), shape_up(0), shape_down(0),
- mouseOver(false), origw(w), origh(h) {
+ int font, uint32 mouseOverBlendCol,
+ int w, int h, int32 layer) :
+ Gump(x, y, w, h, 0, 0, layer), _shapeUp(0), _shapeDown(0),
+ _mouseOver(false), _origW(w), _origH(h) {
TextWidget *widget = new TextWidget(0, 0, txt, gamefont, font, w, h);
- textwidget = widget->getObjId();
- mouseOverBlendCol = mouseOverBlendCol_;
- mouseOver = (mouseOverBlendCol != 0);
+ _textWidget = widget->getObjId();
+ _mouseOverBlendCol = mouseOverBlendCol;
+ _mouseOver = (_mouseOverBlendCol != 0);
}
ButtonWidget::ButtonWidget(int x, int y, FrameID frame_up, FrameID frame_down,
- bool _mouseOver, int32 layer_)
- : Gump(x, y, 5, 5, 0, 0, layer_), textwidget(0), mouseOver(_mouseOver) {
- shape_up = GameData::get_instance()->getShape(frame_up);
- shape_down = GameData::get_instance()->getShape(frame_down);
- _frameNum_up = frame_up._frameNum;
- _frameNum_down = frame_down._frameNum;
+ bool _mouseOver, int32 layer)
+ : Gump(x, y, 5, 5, 0, 0, layer), _textWidget(0), _mouseOver(_mouseOver) {
+ _shapeUp = GameData::get_instance()->getShape(frame_up);
+ _shapeDown = GameData::get_instance()->getShape(frame_down);
+ _frameNumUp = frame_up._frameNum;
+ _frameNumDown = frame_down._frameNum;
}
@@ -70,18 +69,18 @@ ButtonWidget::~ButtonWidget(void) {
void ButtonWidget::InitGump(Gump *newparent, bool take_focus) {
Gump::InitGump(newparent, take_focus);
- if (textwidget != 0) {
- Gump *widget = getGump(textwidget);
+ if (_textWidget != 0) {
+ Gump *widget = getGump(_textWidget);
assert(widget);
widget->InitGump(this);
widget->GetDims(_dims); // transfer child dimension to self
widget->Move(0, _dims.y); // move it to the correct height
} else {
- assert(shape_up != 0);
- assert(shape_down != 0);
+ assert(_shapeUp != 0);
+ assert(_shapeDown != 0);
- _shape = shape_up;
- _frameNum = _frameNum_up;
+ _shape = _shapeUp;
+ _frameNum = _frameNumUp;
ShapeFrame *sf = _shape->getFrame(_frameNum);
assert(sf);
@@ -91,8 +90,8 @@ void ButtonWidget::InitGump(Gump *newparent, bool take_focus) {
}
int ButtonWidget::getVlead() {
- if (textwidget != 0) {
- Gump *widget = getGump(textwidget);
+ if (_textWidget != 0) {
+ Gump *widget = getGump(_textWidget);
TextWidget *txtWidget = p_dynamic_cast<TextWidget *>(widget);
assert(txtWidget);
return txtWidget->getVlead();
@@ -119,9 +118,9 @@ Gump *ButtonWidget::OnMouseDown(int button, int32 mx, int32 my) {
if (ret) return ret;
if (button == Shared::BUTTON_LEFT) {
// CHECKME: change dimensions or not?
- if (!mouseOver) {
- _shape = shape_down;
- _frameNum = _frameNum_down;
+ if (!_mouseOver) {
+ _shape = _shapeDown;
+ _frameNum = _frameNumDown;
}
return this;
}
@@ -138,9 +137,9 @@ uint16 ButtonWidget::TraceObjId(int32 mx, int32 my) {
void ButtonWidget::OnMouseUp(int button, int32 mx, int32 my) {
if (button == Shared::BUTTON_LEFT) {
- if (!mouseOver) {
- _shape = shape_up;
- _frameNum = _frameNum_up;
+ if (!_mouseOver) {
+ _shape = _shapeUp;
+ _frameNum = _frameNumUp;
}
_parent->ChildNotify(this, BUTTON_UP);
}
@@ -157,29 +156,29 @@ void ButtonWidget::OnMouseDouble(int button, int32 mx, int32 my) {
}
void ButtonWidget::OnMouseOver() {
- if (mouseOver) {
- if (textwidget) {
- Gump *widget = getGump(textwidget);
+ if (_mouseOver) {
+ if (_textWidget) {
+ Gump *widget = getGump(_textWidget);
TextWidget *txtWidget = p_dynamic_cast<TextWidget *>(widget);
assert(txtWidget);
- txtWidget->setBlendColour(mouseOverBlendCol);
+ txtWidget->setBlendColour(_mouseOverBlendCol);
} else {
- _shape = shape_down;
- _frameNum = _frameNum_down;
+ _shape = _shapeDown;
+ _frameNum = _frameNumDown;
}
}
}
void ButtonWidget::OnMouseLeft() {
- if (mouseOver) {
- if (textwidget) {
- Gump *widget = getGump(textwidget);
+ if (_mouseOver) {
+ if (_textWidget) {
+ Gump *widget = getGump(_textWidget);
TextWidget *txtWidget = p_dynamic_cast<TextWidget *>(widget);
assert(txtWidget);
txtWidget->setBlendColour(0);
} else {
- _shape = shape_up;
- _frameNum = _frameNum_up;
+ _shape = _shapeUp;
+ _frameNum = _frameNumUp;
}
}
}
@@ -187,70 +186,70 @@ void ButtonWidget::OnMouseLeft() {
void ButtonWidget::saveData(ODataSource *ods) {
// HACK ALERT
int w = 0, h = 0;
- if (textwidget != 0) {
+ if (_textWidget != 0) {
w = _dims.w;
h = _dims.h;
- _dims.w = origw;
- _dims.h = origh;
+ _dims.w = _origW;
+ _dims.h = _origH;
}
Gump::saveData(ods);
// HACK ALERT
- if (textwidget != 0) {
+ if (_textWidget != 0) {
_dims.w = w;
_dims.h = h;
}
uint16 flex = 0;
uint32 shapenum = 0;
- if (shape_up) {
- shape_up->getShapeId(flex, shapenum);
+ if (_shapeUp) {
+ _shapeUp->getShapeId(flex, shapenum);
}
ods->write2(flex);
ods->write4(shapenum);
- ods->write4(_frameNum_up);
+ ods->write4(_frameNumUp);
flex = 0;
shapenum = 0;
- if (shape_down) {
- shape_down->getShapeId(flex, shapenum);
+ if (_shapeDown) {
+ _shapeDown->getShapeId(flex, shapenum);
}
ods->write2(flex);
ods->write4(shapenum);
- ods->write4(_frameNum_down);
- ods->write2(textwidget);
- ods->write4(mouseOverBlendCol);
+ ods->write4(_frameNumDown);
+ ods->write2(_textWidget);
+ ods->write4(_mouseOverBlendCol);
- uint8 m = (mouseOver ? 1 : 0);
+ uint8 m = (_mouseOver ? 1 : 0);
ods->write1(m);
}
bool ButtonWidget::loadData(IDataSource *ids, uint32 version) {
if (!Gump::loadData(ids, version)) return false;
- shape_up = 0;
+ _shapeUp = 0;
ShapeArchive *flex = GameData::get_instance()->getShapeFlex(ids->read2());
uint32 shapenum = ids->read4();
if (flex) {
- shape_up = flex->getShape(shapenum);
+ _shapeUp = flex->getShape(shapenum);
}
- _frameNum_up = ids->read4();
+ _frameNumUp = ids->read4();
- shape_down = 0;
+ _shapeDown = 0;
flex = GameData::get_instance()->getShapeFlex(ids->read2());
shapenum = ids->read4();
if (flex) {
- shape_down = flex->getShape(shapenum);
+ _shapeDown = flex->getShape(shapenum);
}
- _frameNum_down = ids->read4();
- textwidget = ids->read2();
- mouseOverBlendCol = ids->read4();
- mouseOver = (ids->read1() != 0);
+ _frameNumDown = ids->read4();
+ _textWidget = ids->read2();
+ _mouseOverBlendCol = ids->read4();
+ _mouseOver = (ids->read1() != 0);
// HACK ALERT
- if (textwidget != 0) {
- Gump *widget = getGump(textwidget);
+ if (_textWidget != 0) {
+ Gump *widget = getGump(_textWidget);
widget->GetDims(_dims); // transfer child dimension to self
widget->Move(0, _dims.y); // move it to the correct height
}
diff --git a/engines/ultima/ultima8/gumps/widgets/button_widget.h b/engines/ultima/ultima8/gumps/widgets/button_widget.h
index be62026..8b91665 100644
--- a/engines/ultima/ultima8/gumps/widgets/button_widget.h
+++ b/engines/ultima/ultima8/gumps/widgets/button_widget.h
@@ -68,14 +68,14 @@ public:
};
protected:
- Shape *shape_up;
- uint32 _frameNum_up;
- Shape *shape_down;
- uint32 _frameNum_down;
- uint16 textwidget;
- uint32 mouseOverBlendCol;
- bool mouseOver;
- int origw, origh;
+ Shape *_shapeUp;
+ uint32 _frameNumUp;
+ Shape *_shapeDown;
+ uint32 _frameNumDown;
+ uint16 _textWidget;
+ uint32 _mouseOverBlendCol;
+ bool _mouseOver;
+ int _origW, _origH;
public:
bool loadData(IDataSource *ids, uint32 version);
diff --git a/engines/ultima/ultima8/gumps/widgets/edit_widget.cpp b/engines/ultima/ultima8/gumps/widgets/edit_widget.cpp
index 656f42e..4039abb 100644
--- a/engines/ultima/ultima8/gumps/widgets/edit_widget.cpp
+++ b/engines/ultima/ultima8/gumps/widgets/edit_widget.cpp
@@ -40,15 +40,15 @@ DEFINE_RUNTIME_CLASSTYPE_CODE(EditWidget, Gump)
EditWidget::EditWidget(int x, int y, Std::string txt, bool gamefont_, int font,
int w, int h, unsigned int maxlength_, bool multiline_)
- : Gump(x, y, w, h), text(txt), gamefont(gamefont_), fontnum(font),
- maxlength(maxlength_), multiline(multiline_),
- cursor_changed(0), cursor_visible(true), cached_text(0) {
- cursor = text.size();
+ : Gump(x, y, w, h), _text(txt), _gameFont(gamefont_), _fontNum(font),
+ _maxLength(maxlength_), _multiLine(multiline_),
+ _cursorChanged(0), _cursorVisible(true), _cachedText(0) {
+ _cursor = _text.size();
}
EditWidget::~EditWidget(void) {
- delete cached_text;
- cached_text = 0;
+ delete _cachedText;
+ _cachedText = 0;
}
// Init the gump, call after construction
@@ -63,28 +63,28 @@ void EditWidget::InitGump(Gump *newparent, bool take_focus) {
// No X offset
_dims.x = 0;
- if (gamefont && getFont()->isHighRes()) {
+ if (_gameFont && getFont()->isHighRes()) {
int32 x_ = 0, y_ = 0, w = 0;
ScreenSpaceToGumpRect(x_, y_, w, _dims.y, ROUND_OUTSIDE);
}
}
Font *EditWidget::getFont() const {
- if (gamefont)
- return FontManager::get_instance()->getGameFont(fontnum, true);
+ if (_gameFont)
+ return FontManager::get_instance()->getGameFont(_fontNum, true);
else
- return FontManager::get_instance()->getTTFont(fontnum);
+ return FontManager::get_instance()->getTTFont(_fontNum);
}
void EditWidget::setText(const Std::string &t) {
- text = t;
- cursor = text.size();
- FORGET_OBJECT(cached_text);
+ _text = t;
+ _cursor = _text.size();
+ FORGET_OBJECT(_cachedText);
}
void EditWidget::ensureCursorVisible() {
- cursor_visible = true;
- cursor_changed = g_system->getMillis();
+ _cursorVisible = true;
+ _cursorChanged = g_system->getMillis();
}
bool EditWidget::textFits(Std::string &t) {
@@ -93,9 +93,9 @@ bool EditWidget::textFits(Std::string &t) {
unsigned int remaining;
int32 width, height;
- int32 max_width = multiline ? _dims.w : 0;
+ int32 max_width = _multiLine ? _dims.w : 0;
int32 max_height = _dims.h;
- if (gamefont && font->isHighRes()) {
+ if (_gameFont && font->isHighRes()) {
int32 x_ = 0, y_ = 0;
GumpRectToScreenSpace(x_, y_, max_width, max_height, ROUND_INSIDE);
}
@@ -104,49 +104,49 @@ bool EditWidget::textFits(Std::string &t) {
max_width, max_height,
Font::TEXT_LEFT, false);
- if (gamefont && font->isHighRes()) {
+ if (_gameFont && font->isHighRes()) {
int32 x_ = 0, y_ = 0;
ScreenSpaceToGumpRect(x_, y_, width, height, ROUND_OUTSIDE);
}
- if (multiline)
+ if (_multiLine)
return (remaining >= t.size());
else
return (width <= _dims.w);
}
void EditWidget::renderText() {
- bool cv = cursor_visible;
+ bool cv = _cursorVisible;
if (!IsFocus()) {
cv = false;
} else {
uint32 now = g_system->getMillis();
- if (now > cursor_changed + 750) {
- cv = !cursor_visible;
- cursor_changed = now;
+ if (now > _cursorChanged + 750) {
+ cv = !_cursorVisible;
+ _cursorChanged = now;
}
}
- if (cv != cursor_visible) {
- FORGET_OBJECT(cached_text);
- cursor_visible = cv;
+ if (cv != _cursorVisible) {
+ FORGET_OBJECT(_cachedText);
+ _cursorVisible = cv;
}
- if (!cached_text) {
+ if (!_cachedText) {
Font *font = getFont();
- int32 max_width = multiline ? _dims.w : 0;
+ int32 max_width = _multiLine ? _dims.w : 0;
int32 max_height = _dims.h;
- if (gamefont && font->isHighRes()) {
+ if (_gameFont && font->isHighRes()) {
int32 x_ = 0, y_ = 0;
GumpRectToScreenSpace(x_, y_, max_width, max_height, ROUND_INSIDE);
}
unsigned int remaining;
- cached_text = font->renderText(text, remaining,
+ _cachedText = font->renderText(_text, remaining,
max_width, max_height,
Font::TEXT_LEFT,
- false, cv ? cursor : Std::string::npos);
+ false, cv ? _cursor : Std::string::npos);
}
}
@@ -156,24 +156,24 @@ void EditWidget::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
renderText();
- if (scaled && gamefont && getFont()->isHighRes()) {
+ if (scaled && _gameFont && getFont()->isHighRes()) {
surf->FillAlpha(0xFF, _dims.x, _dims.y, _dims.w, _dims.h);
return;
}
- cached_text->draw(surf, 0, 0);
+ _cachedText->draw(surf, 0, 0);
}
// Overloadable method to Paint just this gumps unscaled components that require compositing (RenderSurface is relative to parent).
void EditWidget::PaintComposited(RenderSurface *surf, int32 lerp_factor, int32 sx, int32 sy) {
Font *font = getFont();
- if (!gamefont || !font->isHighRes()) return;
+ if (!_gameFont || !font->isHighRes()) return;
int32 x_ = 0, y_ = 0;
GumpToScreenSpace(x_, y_, ROUND_BOTTOMRIGHT);
- cached_text->draw(surf, x_, y_, true);
+ _cachedText->draw(surf, x_, y_, true);
x_ = _dims.x;
y_ = _dims.y;
@@ -197,29 +197,29 @@ bool EditWidget::OnKeyDown(int key, int mod) {
_parent->ChildNotify(this, EDIT_ESCAPE);
break;
case Common::KEYCODE_BACKSPACE:
- if (cursor > 0) {
- text.erase(--cursor, 1);
- FORGET_OBJECT(cached_text);
+ if (_cursor > 0) {
+ _text.erase(--_cursor, 1);
+ FORGET_OBJECT(_cachedText);
ensureCursorVisible();
}
break;
case Common::KEYCODE_DELETE:
- if (cursor != text.size()) {
- text.erase(cursor, 1);
- FORGET_OBJECT(cached_text);
+ if (_cursor != _text.size()) {
+ _text.erase(_cursor, 1);
+ FORGET_OBJECT(_cachedText);
}
break;
case Common::KEYCODE_LEFT:
- if (cursor > 0) {
- cursor--;
- FORGET_OBJECT(cached_text);
+ if (_cursor > 0) {
+ _cursor--;
+ FORGET_OBJECT(_cachedText);
ensureCursorVisible();
}
break;
case Common::KEYCODE_RIGHT:
- if (cursor < text.size()) {
- cursor++;
- FORGET_OBJECT(cached_text);
+ if (_cursor < _text.size()) {
+ _cursor++;
+ FORGET_OBJECT(_cachedText);
ensureCursorVisible();
}
break;
@@ -236,7 +236,7 @@ bool EditWidget::OnKeyUp(int key) {
bool EditWidget::OnTextInput(int unicode) {
- if (maxlength > 0 && text.size() >= maxlength)
+ if (_maxLength > 0 && _text.size() >= _maxLength)
return true;
char c = 0;
@@ -244,13 +244,13 @@ bool EditWidget::OnTextInput(int unicode) {
c = reverse_encoding[unicode];
if (!c) return true;
- Std::string newtext = text;
- newtext.insert(cursor, 1, c);
+ Std::string newtext = _text;
+ newtext.insert(_cursor, 1, c);
if (textFits(newtext)) {
- text = newtext;
- cursor++;
- FORGET_OBJECT(cached_text);
+ _text = newtext;
+ _cursor++;
+ FORGET_OBJECT(_cachedText);
}
return true;
diff --git a/engines/ultima/ultima8/gumps/widgets/edit_widget.h b/engines/ultima/ultima8/gumps/widgets/edit_widget.h
index 540e529..841f800 100644
--- a/engines/ultima/ultima8/gumps/widgets/edit_widget.h
+++ b/engines/ultima/ultima8/gumps/widgets/edit_widget.h
@@ -58,7 +58,7 @@ public:
//! get the current text
Std::string getText() const {
- return text;
+ return _text;
}
void setText(const Std::string &t);
@@ -69,22 +69,22 @@ public:
protected:
- Std::string text;
- Std::string::size_type cursor;
- bool gamefont;
- int fontnum;
- unsigned int maxlength;
- bool multiline;
+ Std::string _text;
+ Std::string::size_type _cursor;
+ bool _gameFont;
+ int _fontNum;
+ unsigned int _maxLength;
+ bool _multiLine;
- uint32 cursor_changed;
- bool cursor_visible;
+ uint32 _cursorChanged;
+ bool _cursorVisible;
void ensureCursorVisible();
bool textFits(Std::string &t);
void renderText();
Font *getFont() const;
- RenderedText *cached_text;
+ RenderedText *_cachedText;
};
diff --git a/engines/ultima/ultima8/gumps/widgets/game_widget.cpp b/engines/ultima/ultima8/gumps/widgets/game_widget.cpp
index 12e9733..0f838f8 100644
--- a/engines/ultima/ultima8/gumps/widgets/game_widget.cpp
+++ b/engines/ultima/ultima8/gumps/widgets/game_widget.cpp
@@ -37,30 +37,29 @@ DEFINE_RUNTIME_CLASSTYPE_CODE(GameWidget, Gump)
GameWidget::GameWidget(int x, int y, istring &game)
- : Gump(x, y, 443, 109), highlight(false) {
- info = Ultima8Engine::get_instance()->getGameInfo(game);
- assert(info);
+ : Gump(x, y, 443, 109), _highlight(false) {
+ _info = Ultima8Engine::get_instance()->getGameInfo(game);
+ assert(_info);
}
GameWidget::~GameWidget() {
-
}
istring GameWidget::getGameName() {
- return info->_name;
+ return _info->_name;
}
void GameWidget::InitGump(Gump *newparent, bool take_focus) {
Gump::InitGump(newparent, take_focus);
// setup children
- Gump *w = new TextWidget(65, 2, info->getGameTitle(),
+ Gump *w = new TextWidget(65, 2, _info->getGameTitle(),
false, 0, 350, 180);
w->InitGump(this, false);
// FIXME: localize these strings
Std::string gamename = "Game:";
gamename += " ";
- gamename += info->_name;
+ gamename += _info->_name;
w = new TextWidget(65, 29, gamename, false, 0, 350, 180);
w->InitGump(this, false);
@@ -69,7 +68,7 @@ void GameWidget::InitGump(Gump *newparent, bool take_focus) {
w = new TextWidget(65, 50, path, false, 0, 350, 180);
w->InitGump(this, false);
- Std::string version = info->getPrintableVersion();
+ Std::string version = _info->getPrintableVersion();
w = new TextWidget(360, 70, version, false, 2, 70, 0, Font::TEXT_RIGHT);
w->InitGump(this, false);
@@ -113,11 +112,11 @@ Gump *GameWidget::OnMouseDown(int button, int32 mx, int32 my) {
}
void GameWidget::OnMouseOver() {
- highlight = true;
+ _highlight = true;
}
void GameWidget::OnMouseLeft() {
- highlight = false;
+ _highlight = false;
}
@@ -145,14 +144,14 @@ void GameWidget::PaintThis(RenderSurface *surf, int32 lerp_factor, bool /*scaled
// box graphics
// surf->Fill32(0xFFAFAFFF,1,1,56,80);
- surf->Blit(coversImage, (info->_type - 1) * 56, 0, 56, 80, 1, 1); // HACK...
+ surf->Blit(coversImage, (_info->_type - 1) * 56, 0, 56, 80, 1, 1); // HACK...
- if (highlight)
+ if (_highlight)
surf->Fill32(0xFF30308F, 58, 1, 443 - 57 - 2, 22);
// flag
// surf->Fill32(0xFFAFFFAF,415,4,24,16);
- surf->Blit(flagsImage, (info->_language - 1) * 24, 0, 24, 16, 415, 4); // HACK...
+ surf->Blit(flagsImage, (_info->_language - 1) * 24, 0, 24, 16, 415, 4); // HACK...
#if 0
diff --git a/engines/ultima/ultima8/gumps/widgets/game_widget.h b/engines/ultima/ultima8/gumps/widgets/game_widget.h
index 43e5bd1..c5dbced 100644
--- a/engines/ultima/ultima8/gumps/widgets/game_widget.h
+++ b/engines/ultima/ultima8/gumps/widgets/game_widget.h
@@ -61,9 +61,9 @@ public:
};
protected:
- GameInfo *info;
+ GameInfo *_info;
- bool highlight;
+ bool _highlight;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/gumps/widgets/text_widget.cpp b/engines/ultima/ultima8/gumps/widgets/text_widget.cpp
index d1f28b9..cbaf9c9 100644
--- a/engines/ultima/ultima8/gumps/widgets/text_widget.cpp
+++ b/engines/ultima/ultima8/gumps/widgets/text_widget.cpp
@@ -38,21 +38,21 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(TextWidget, Gump)
-TextWidget::TextWidget() : Gump(), gamefont(false), fontnum(0), blendColour(0),
- tx(0), ty(0), current_start(0), current_end(0), targetwidth(0), targetheight(0),
- cached_text(0), textalign(Font::TEXT_LEFT) {
+TextWidget::TextWidget() : Gump(), _gameFont(false), _fontNum(0), _blendColour(0),
+ _tx(0), _ty(0), _currentStart(0), _currentEnd(0), _targetWidth(0), _targetHeight(0),
+ _cachedText(0), _textAlign(Font::TEXT_LEFT) {
}
TextWidget::TextWidget(int x, int y, Std::string txt, bool gamefont_, int font,
int w, int h, Font::TextAlign align) :
- Gump(x, y, w, h), text(txt), gamefont(gamefont_), fontnum(font),
- blendColour(0), current_start(0), current_end(0),
- targetwidth(w), targetheight(h), cached_text(0), textalign(align) {
+ Gump(x, y, w, h), _text(txt), _gameFont(gamefont_), _fontNum(font),
+ _blendColour(0), _currentStart(0), _currentEnd(0),
+ _targetWidth(w), _targetHeight(h), _cachedText(0), _textAlign(align) {
}
TextWidget::~TextWidget(void) {
- delete cached_text;
- cached_text = 0;
+ delete _cachedText;
+ _cachedText = 0;
}
// Init the gump, call after construction
@@ -67,7 +67,7 @@ void TextWidget::InitGump(Gump *newparent, bool take_focus) {
// No X offset
_dims.x = 0;
- if (gamefont && getFont()->isHighRes()) {
+ if (_gameFont && getFont()->isHighRes()) {
int32 w = 0;
int32 x_ = 0, y_ = 0;
ScreenSpaceToGumpRect(x_, y_, w, _dims.y, ROUND_OUTSIDE);
@@ -76,11 +76,11 @@ void TextWidget::InitGump(Gump *newparent, bool take_focus) {
int32 ty_ = _dims.y;
// Note that GumpRectToScreenSpace is guaranteed to keep
- // targetwidth/targetheight zero if they already were.
- GumpRectToScreenSpace(tx_, ty_, targetwidth, targetheight, ROUND_OUTSIDE);
+ // _targetWidth/_targetHeight zero if they already were.
+ GumpRectToScreenSpace(tx_, ty_, _targetWidth, _targetHeight, ROUND_OUTSIDE);
- _dims.w = targetwidth;
- _dims.h = targetheight;
+ _dims.w = _targetWidth;
+ _dims.h = _targetHeight;
x_ = 0;
y_ = 0;
ScreenSpaceToGumpRect(x_, y_, _dims.w, _dims.h, ROUND_OUTSIDE);
@@ -91,11 +91,11 @@ void TextWidget::InitGump(Gump *newparent, bool take_focus) {
int TextWidget::getVlead() {
renderText();
- assert(cached_text);
+ assert(_cachedText);
- int32 vlead = cached_text->getVlead();
+ int32 vlead = _cachedText->getVlead();
- if (gamefont && getFont()->isHighRes()) {
+ if (_gameFont && getFont()->isHighRes()) {
int32 xv = 0, yv = 0, w = 0;
ScreenSpaceToGumpRect(xv, yv, w, vlead, ROUND_OUTSIDE);
}
@@ -104,34 +104,34 @@ int TextWidget::getVlead() {
}
Font *TextWidget::getFont() const {
- if (gamefont)
- return FontManager::get_instance()->getGameFont(fontnum, true);
+ if (_gameFont)
+ return FontManager::get_instance()->getGameFont(_fontNum, true);
else
- return FontManager::get_instance()->getTTFont(fontnum);
+ return FontManager::get_instance()->getTTFont(_fontNum);
}
bool TextWidget::setupNextText() {
- current_start = current_end;
+ _currentStart = _currentEnd;
- if (current_start >= text.size()) return false;
+ if (_currentStart >= _text.size()) return false;
Font *font = getFont();
unsigned int remaining;
- font->getTextSize(text.substr(current_start), tx, ty, remaining,
- targetwidth, targetheight, textalign, true);
+ font->getTextSize(_text.substr(_currentStart), _tx, _ty, remaining,
+ _targetWidth, _targetHeight, _textAlign, true);
- _dims.w = tx;
- _dims.h = ty;
+ _dims.w = _tx;
+ _dims.h = _ty;
_dims.y = -font->getBaseline();
_dims.x = 0;
- current_end = current_start + remaining;
+ _currentEnd = _currentStart + remaining;
- delete cached_text;
- cached_text = 0;
+ delete _cachedText;
+ _cachedText = 0;
- if (gamefont) {
+ if (_gameFont) {
Font *fontP = getFont();
if (fontP->isHighRes()) {
int32 x_ = 0, y_ = 0;
@@ -148,20 +148,20 @@ bool TextWidget::setupNextText() {
}
void TextWidget::rewind() {
- current_start = 0;
- current_end = 0;
+ _currentStart = 0;
+ _currentEnd = 0;
setupNextText();
}
void TextWidget::renderText() {
- if (!cached_text) {
+ if (!_cachedText) {
Font *font = getFont();
unsigned int remaining;
- cached_text = font->renderText(text.substr(current_start,
- current_end - current_start),
- remaining, targetwidth, targetheight,
- textalign, true);
+ _cachedText = font->renderText(_text.substr(_currentStart,
+ _currentEnd - _currentStart),
+ remaining, _targetWidth, _targetHeight,
+ _textAlign, true);
}
}
@@ -171,30 +171,30 @@ void TextWidget::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
renderText();
- if (scaled && gamefont && getFont()->isHighRes()) {
+ if (scaled && _gameFont && getFont()->isHighRes()) {
surf->FillAlpha(0xFF, _dims.x, _dims.y, _dims.w, _dims.h);
return;
}
- if (!blendColour)
- cached_text->draw(surf, 0, 0);
+ if (!_blendColour)
+ _cachedText->draw(surf, 0, 0);
else
- cached_text->drawBlended(surf, 0, 0, blendColour);
+ _cachedText->drawBlended(surf, 0, 0, _blendColour);
}
// Overloadable method to Paint just this gumps unscaled components that require compositing (RenderSurface is relative to parent).
void TextWidget::PaintComposited(RenderSurface *surf, int32 lerp_factor, int32 sx, int32 sy) {
Font *font = getFont();
- if (!gamefont || !font->isHighRes()) return;
+ if (!_gameFont || !font->isHighRes()) return;
int32 x_ = 0, y_ = 0;
GumpToScreenSpace(x_, y_, ROUND_BOTTOMRIGHT);
- if (!blendColour)
- cached_text->draw(surf, x_, y_, true);
+ if (!_blendColour)
+ _cachedText->draw(surf, x_, y_, true);
else
- cached_text->drawBlended(surf, x_, y_, blendColour, true);
+ _cachedText->drawBlended(surf, x_, y_, _blendColour, true);
if (_parent->IsOfType<BarkGump>()) return;
@@ -216,39 +216,39 @@ Gump *TextWidget::OnMouseMotion(int32 mx, int32 my) {
void TextWidget::saveData(ODataSource *ods) {
Gump::saveData(ods);
- ods->write1(gamefont ? 1 : 0);
- ods->write4(static_cast<uint32>(fontnum));
- ods->write4(blendColour);
- ods->write4(static_cast<uint32>(current_start));
- ods->write4(static_cast<uint32>(current_end));
- ods->write4(static_cast<uint32>(targetwidth));
- ods->write4(static_cast<uint32>(targetheight));
- ods->write2(static_cast<uint16>(textalign));
- ods->write4(text.size());
- ods->write(text.c_str(), text.size());
+ ods->write1(_gameFont ? 1 : 0);
+ ods->write4(static_cast<uint32>(_fontNum));
+ ods->write4(_blendColour);
+ ods->write4(static_cast<uint32>(_currentStart));
+ ods->write4(static_cast<uint32>(_currentEnd));
+ ods->write4(static_cast<uint32>(_targetWidth));
+ ods->write4(static_cast<uint32>(_targetHeight));
+ ods->write2(static_cast<uint16>(_textAlign));
+ ods->write4(_text.size());
+ ods->write(_text.c_str(), _text.size());
}
bool TextWidget::loadData(IDataSource *ids, uint32 version) {
if (!Gump::loadData(ids, version)) return false;
- gamefont = (ids->read1() != 0);
- fontnum = static_cast<int>(ids->read4());
- blendColour = ids->read4();
- current_start = static_cast<int>(ids->read4());
- current_end = static_cast<int>(ids->read4());
- targetwidth = static_cast<int>(ids->read4());
- targetheight = static_cast<int>(ids->read4());
- textalign = static_cast<Font::TextAlign>(ids->read2());
+ _gameFont = (ids->read1() != 0);
+ _fontNum = static_cast<int>(ids->read4());
+ _blendColour = ids->read4();
+ _currentStart = static_cast<int>(ids->read4());
+ _currentEnd = static_cast<int>(ids->read4());
+ _targetWidth = static_cast<int>(ids->read4());
+ _targetHeight = static_cast<int>(ids->read4());
+ _textAlign = static_cast<Font::TextAlign>(ids->read2());
uint32 slen = ids->read4();
if (slen > 0) {
char *buf = new char[slen + 1];
ids->read(buf, slen);
buf[slen] = 0;
- text = buf;
+ _text = buf;
delete[] buf;
} else {
- text = "";
+ _text = "";
}
// HACK ALERT: this is to deal with possibly changing font sizes
@@ -257,14 +257,14 @@ bool TextWidget::loadData(IDataSource *ids, uint32 version) {
int32 tx_, ty_;
unsigned int remaining;
- font->getTextSize(text.substr(current_start), tx_, ty_, remaining,
- targetwidth, targetheight, textalign, true);
+ font->getTextSize(_text.substr(_currentStart), tx_, ty_, remaining,
+ _targetWidth, _targetHeight, _textAlign, true);
// Y offset is always baseline
_dims.y = -font->getBaseline();
_dims.w = tx_;
_dims.h = ty_;
- current_end = current_start + remaining;
+ _currentEnd = _currentStart + remaining;
return true;
}
diff --git a/engines/ultima/ultima8/gumps/widgets/text_widget.h b/engines/ultima/ultima8/gumps/widgets/text_widget.h
index ec3dc89..7ff9ce8 100644
--- a/engines/ultima/ultima8/gumps/widgets/text_widget.h
+++ b/engines/ultima/ultima8/gumps/widgets/text_widget.h
@@ -38,19 +38,19 @@ class RenderedText;
class TextWidget : public Gump {
protected:
- Std::string text;
- bool gamefont;
- int fontnum;
- uint32 blendColour;
- int32 tx, ty;
+ Std::string _text;
+ bool _gameFont;
+ int _fontNum;
+ uint32 _blendColour;
+ int32 _tx, _ty;
- unsigned int current_start; //!< start of currently displaying text
- unsigned int current_end; //!< start of remaining text
+ unsigned int _currentStart; //!< start of currently displaying text
+ unsigned int _currentEnd; //!< start of remaining text
- int32 targetwidth, targetheight;
+ int32 _targetWidth, _targetHeight;
- RenderedText *cached_text;
- Font::TextAlign textalign;
+ RenderedText *_cachedText;
+ Font::TextAlign _textAlign;
public:
ENABLE_RUNTIME_CLASSTYPE()
@@ -81,13 +81,13 @@ public:
//! \param start Returns the start of the text
//! \param end Returns the start of the remaining text
void getCurrentText(unsigned int &start, unsigned int &end) const {
- start = current_start;
- end = current_end;
+ start = _currentStart;
+ end = _currentEnd;
}
//! set the colour to blend the rendered text with. (0 to disable)
void setBlendColour(uint32 col) {
- blendColour = col;
+ _blendColour = col;
}
//! get the RenderedText's vlead
Commit: 3dbee986c09e1db6f08c790af40db77ed04b2916
https://github.com/scummvm/scummvm/commit/3dbee986c09e1db6f08c790af40db77ed04b2916
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-17T19:42:21-08:00
Commit Message:
ULTIMA8: Renaming world folder class fields
Changed paths:
engines/ultima/ultima8/graphics/type_flags.cpp
engines/ultima/ultima8/gumps/container_gump.cpp
engines/ultima/ultima8/gumps/paperdoll_gump.cpp
engines/ultima/ultima8/world/actors/actor.cpp
engines/ultima/ultima8/world/actors/animation_tracker.cpp
engines/ultima/ultima8/world/actors/main_actor.cpp
engines/ultima/ultima8/world/armour_info.h
engines/ultima/ultima8/world/camera_process.cpp
engines/ultima/ultima8/world/camera_process.h
engines/ultima/ultima8/world/container.cpp
engines/ultima/ultima8/world/container.h
engines/ultima/ultima8/world/create_item_process.cpp
engines/ultima/ultima8/world/create_item_process.h
engines/ultima/ultima8/world/current_map.cpp
engines/ultima/ultima8/world/current_map.h
engines/ultima/ultima8/world/item.cpp
engines/ultima/ultima8/world/missile_tracker.cpp
engines/ultima/ultima8/world/world.cpp
diff --git a/engines/ultima/ultima8/graphics/type_flags.cpp b/engines/ultima/ultima8/graphics/type_flags.cpp
index f0f0abd..95aaf53 100644
--- a/engines/ultima/ultima8/graphics/type_flags.cpp
+++ b/engines/ultima/ultima8/graphics/type_flags.cpp
@@ -238,43 +238,43 @@ void TypeFlags::loadArmourInfo() {
int val;
config->get(k + "/shape", val);
- ai.shape = static_cast<uint32>(val);
+ ai._shape = static_cast<uint32>(val);
- assert(ai.shape < shapeInfo.size());
- assert(msf->getShape(ai.shape));
- unsigned int framecount = msf->getShape(ai.shape)->frameCount();
- ArmourInfo *aia = shapeInfo[ai.shape]._armourInfo;
+ assert(ai._shape < shapeInfo.size());
+ assert(msf->getShape(ai._shape));
+ unsigned int framecount = msf->getShape(ai._shape)->frameCount();
+ ArmourInfo *aia = shapeInfo[ai._shape]._armourInfo;
if (!aia) {
aia = new ArmourInfo[framecount];
- shapeInfo[ai.shape]._armourInfo = aia;
+ shapeInfo[ai._shape]._armourInfo = aia;
for (unsigned int i = 0; i < framecount; ++i) {
- aia[i].shape = 0;
- aia[i].frame = 0;
- aia[i].armour_class = 0;
- aia[i].defense_type = 0;
- aia[i].kick_attack_bonus = 0;
+ aia[i]._shape = 0;
+ aia[i]._frame = 0;
+ aia[i]._armourClass = 0;
+ aia[i]._defenseType = 0;
+ aia[i]._kickAttackBonus = 0;
}
}
config->get(k + "/frame", val);
- ai.frame = static_cast<uint32>(val);
+ ai._frame = static_cast<uint32>(val);
- assert(ai.frame < framecount);
+ assert(ai._frame < framecount);
config->get(k + "/armour", val);
- ai.armour_class = static_cast<uint16>(val);
+ ai._armourClass = static_cast<uint16>(val);
if (config->get(k + "/type", val))
- ai.defense_type = static_cast<uint16>(val);
+ ai._defenseType = static_cast<uint16>(val);
else
- ai.defense_type = 0;
+ ai._defenseType = 0;
if (config->get(k + "/kick_bonus", val))
- ai.kick_attack_bonus = static_cast<uint16>(val);
+ ai._kickAttackBonus = static_cast<uint16>(val);
else
- ai.kick_attack_bonus = 0;
+ ai._kickAttackBonus = 0;
- aia[ai.frame] = ai;
+ aia[ai._frame] = ai;
}
}
diff --git a/engines/ultima/ultima8/gumps/container_gump.cpp b/engines/ultima/ultima8/gumps/container_gump.cpp
index f67f518..c1defae 100644
--- a/engines/ultima/ultima8/gumps/container_gump.cpp
+++ b/engines/ultima/ultima8/gumps/container_gump.cpp
@@ -81,7 +81,7 @@ void ContainerGump::InitGump(Gump *newparent, bool take_focus) {
if (!c) return; // Container gone!?
- Std::list<Item *> &contents = c->contents;
+ Std::list<Item *> &contents = c->_contents;
Std::list<Item *>::iterator iter;
for (iter = contents.begin(); iter != contents.end(); ++iter) {
(*iter)->enterFastArea();
@@ -122,7 +122,7 @@ void ContainerGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scale
return;
}
- Std::list<Item *> &contents = c->contents;
+ Std::list<Item *> &contents = c->_contents;
int32 gametick = Kernel::get_instance()->getFrameNum();
//!! TODO: check these painting commands (flipped? translucent?)
@@ -170,7 +170,7 @@ uint16 ContainerGump::TraceObjId(int32 mx, int32 my) {
bool paintEditorItems = Ultima8Engine::get_instance()->isPaintEditorItems();
- Std::list<Item *> &contents = c->contents;
+ Std::list<Item *> &contents = c->_contents;
Std::list<Item *>::reverse_iterator iter;
// iterate backwards, since we're painting from begin() to end()
@@ -261,7 +261,7 @@ void ContainerGump::Close(bool no_del) {
Container *c = getContainer(_owner);
if (!c) return; // Container gone!?
- Std::list<Item *> &contents = c->contents;
+ Std::list<Item *> &contents = c->_contents;
Std::list<Item *>::iterator iter = contents.begin();
while (iter != contents.end()) {
Item *item = *iter;
diff --git a/engines/ultima/ultima8/gumps/paperdoll_gump.cpp b/engines/ultima/ultima8/gumps/paperdoll_gump.cpp
index 130cb72..a1f1dbf 100644
--- a/engines/ultima/ultima8/gumps/paperdoll_gump.cpp
+++ b/engines/ultima/ultima8/gumps/paperdoll_gump.cpp
@@ -126,7 +126,7 @@ void PaperdollGump::Close(bool no_del) {
Container *c = getContainer(_owner);
if (!c) return; // Container gone!?
- Std::list<Item *> &contents = c->contents;
+ Std::list<Item *> &contents = c->_contents;
Std::list<Item *>::iterator iter = contents.begin();
while (iter != contents.end()) {
Item *item = *iter;
diff --git a/engines/ultima/ultima8/world/actors/actor.cpp b/engines/ultima/ultima8/world/actors/actor.cpp
index b1826a3..7055ae3 100644
--- a/engines/ultima/ultima8/world/actors/actor.cpp
+++ b/engines/ultima/ultima8/world/actors/actor.cpp
@@ -80,7 +80,7 @@ uint16 Actor::assignObjId() {
_objId = ObjectManager::get_instance()->assignActorObjId(this);
Std::list<Item *>::iterator iter;
- for (iter = contents.begin(); iter != contents.end(); ++iter) {
+ for (iter = _contents.begin(); iter != _contents.end(); ++iter) {
(*iter)->assignObjId();
(*iter)->setParent(_objId);
}
@@ -372,7 +372,7 @@ bool Actor::setEquip(Item *item, bool checkwghtvol) {
// now check 'equipment slots'
// we can have one item of each equipment type, plus one backpack
Std::list<Item *>::iterator iter;
- for (iter = contents.begin(); iter != contents.end(); ++iter) {
+ for (iter = _contents.begin(); iter != _contents.end(); ++iter) {
if ((*iter)->getObjId() == item->getObjId()) continue;
uint32 cet = (*iter)->getShapeInfo()->_equipType;
@@ -394,7 +394,7 @@ uint16 Actor::getEquip(uint32 type) {
const unsigned int backpack_shape = 529; //!! *cough* constant
Std::list<Item *>::iterator iter;
- for (iter = contents.begin(); iter != contents.end(); ++iter) {
+ for (iter = _contents.begin(); iter != _contents.end(); ++iter) {
uint32 cet = (*iter)->getShapeInfo()->_equipType;
bool cbackpack = ((*iter)->getShape() == backpack_shape);
diff --git a/engines/ultima/ultima8/world/actors/animation_tracker.cpp b/engines/ultima/ultima8/world/actors/animation_tracker.cpp
index 00150ff..fc982c7 100644
--- a/engines/ultima/ultima8/world/actors/animation_tracker.cpp
+++ b/engines/ultima/ultima8/world/actors/animation_tracker.cpp
@@ -275,7 +275,7 @@ bool AnimationTracker::step() {
for (it = collisions.begin(); it != collisions.end(); it++) {
// hit something, can't move
- if (!it->touching && it->blocking) {
+ if (!it->_touching && it->_blocking) {
#ifdef WATCHACTOR
if (a->getObjId() == watchactor) {
pout << "AnimationTracker: did sweepTest for large step; "
diff --git a/engines/ultima/ultima8/world/actors/main_actor.cpp b/engines/ultima/ultima8/world/actors/main_actor.cpp
index 6b4f762..3a3dfe6 100644
--- a/engines/ultima/ultima8/world/actors/main_actor.cpp
+++ b/engines/ultima/ultima8/world/actors/main_actor.cpp
@@ -94,7 +94,7 @@ bool MainActor::CanAddItem(Item *item, bool checkwghtvol) {
if (equiptype == ShapeInfo::SE_NONE && !backpack) return false;
Std::list<Item *>::iterator iter;
- for (iter = contents.begin(); iter != contents.end(); ++iter) {
+ for (iter = _contents.begin(); iter != _contents.end(); ++iter) {
uint32 cet = (*iter)->getShapeInfo()->_equipType;
bool cbackpack = ((*iter)->getShape() == backpack_shape);
@@ -174,11 +174,11 @@ uint16 MainActor::getDefenseType() {
uint16 type = 0;
Std::list<Item *>::iterator iter;
- for (iter = contents.begin(); iter != contents.end(); ++iter) {
+ for (iter = _contents.begin(); iter != _contents.end(); ++iter) {
uint32 frameNum = (*iter)->getFrame();
ShapeInfo *si = (*iter)->getShapeInfo();
if (si->_armourInfo) {
- type |= si->_armourInfo[frameNum].defense_type;
+ type |= si->_armourInfo[frameNum]._defenseType;
}
}
@@ -189,11 +189,11 @@ uint32 MainActor::getArmourClass() {
uint32 armour = 0;
Std::list<Item *>::iterator iter;
- for (iter = contents.begin(); iter != contents.end(); ++iter) {
+ for (iter = _contents.begin(); iter != _contents.end(); ++iter) {
uint32 frameNum = (*iter)->getFrame();
ShapeInfo *si = (*iter)->getShapeInfo();
if (si->_armourInfo) {
- armour += si->_armourInfo[frameNum].armour_class;
+ armour += si->_armourInfo[frameNum]._armourClass;
}
if (si->_weaponInfo) {
armour += si->_weaponInfo->armour_bonus;
@@ -257,7 +257,7 @@ int MainActor::getDamageAmount() {
if (legs) {
ShapeInfo *si = legs->getShapeInfo();
assert(si->_armourInfo);
- kick_bonus = si->_armourInfo[legs->getFrame()].kick_attack_bonus;
+ kick_bonus = si->_armourInfo[legs->getFrame()]._kickAttackBonus;
}
damage = (getRandom() % (getStr() / 2 + 1)) + kick_bonus;
diff --git a/engines/ultima/ultima8/world/armour_info.h b/engines/ultima/ultima8/world/armour_info.h
index 744c3d7..f58e92c 100644
--- a/engines/ultima/ultima8/world/armour_info.h
+++ b/engines/ultima/ultima8/world/armour_info.h
@@ -23,14 +23,12 @@
#ifndef ULTIMA8_WORLD_ARMOURINFO_H
#define ULTIMA8_WORLD_ARMOURINFO_H
-
struct ArmourInfo {
- uint32 shape;
- uint32 frame;
- uint16 armour_class;
- uint16 kick_attack_bonus;
- uint16 defense_type; // see WeaponInfo struct
+ uint32 _shape;
+ uint32 _frame;
+ uint16 _armourClass;
+ uint16 _kickAttackBonus;
+ uint16 _defenseType; // see WeaponInfo struct
};
-
#endif
diff --git a/engines/ultima/ultima8/world/camera_process.cpp b/engines/ultima/ultima8/world/camera_process.cpp
index 6d21f4b..6f9e501 100644
--- a/engines/ultima/ultima8/world/camera_process.cpp
+++ b/engines/ultima/ultima8/world/camera_process.cpp
@@ -21,7 +21,6 @@
*/
#include "ultima/ultima8/misc/pent_include.h"
-
#include "ultima/ultima8/world/camera_process.h"
#include "ultima/ultima8/world/world.h"
#include "ultima/ultima8/world/current_map.h"
@@ -32,7 +31,6 @@
#include "ultima/ultima8/kernel/kernel.h"
#include "ultima/ultima8/kernel/core_app.h"
#include "ultima/ultima8/world/get_object.h"
-
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/filesys/odata_source.h"
@@ -45,34 +43,34 @@ DEFINE_RUNTIME_CLASSTYPE_CODE(CameraProcess, Process)
//
// Statics
//
-CameraProcess *CameraProcess::camera = 0;
-int32 CameraProcess::earthquake = 0;
-int32 CameraProcess::eq_x = 0;
-int32 CameraProcess::eq_y = 0;
+CameraProcess *CameraProcess::_camera = 0;
+int32 CameraProcess::_earthquake = 0;
+int32 CameraProcess::_eqX = 0;
+int32 CameraProcess::_eqY = 0;
CameraProcess::CameraProcess() : Process() {
}
CameraProcess::~CameraProcess() {
- if (camera == this)
- camera = 0;
+ if (_camera == this)
+ _camera = 0;
}
uint16 CameraProcess::SetCameraProcess(CameraProcess *cam) {
if (!cam) cam = new CameraProcess(0);
- if (camera) camera->terminate();
- camera = cam;
- return Kernel::get_instance()->addProcess(camera);
+ if (_camera) _camera->terminate();
+ _camera = cam;
+ return Kernel::get_instance()->addProcess(_camera);
}
void CameraProcess::ResetCameraProcess() {
- if (camera) camera->terminate();
- camera = 0;
+ if (_camera) _camera->terminate();
+ _camera = 0;
}
void CameraProcess::GetCameraLocation(int32 &x, int32 &y, int32 &z) {
- if (!camera) {
+ if (!_camera) {
World *world = World::get_instance();
CurrentMap *map = world->getCurrentMap();
int map_num = map->getNum();
@@ -85,12 +83,12 @@ void CameraProcess::GetCameraLocation(int32 &x, int32 &y, int32 &z) {
} else
av->getLocation(x, y, z);
- if (earthquake) {
- x += 2 * eq_x + 4 * eq_y;
- y += -2 * eq_x + 4 * eq_y;
+ if (_earthquake) {
+ x += 2 * _eqX + 4 * _eqY;
+ y += -2 * _eqX + 4 * _eqY;
}
} else {
- camera->GetLerped(x, y, z, 256, true);
+ _camera->GetLerped(x, y, z, 256, true);
}
}
@@ -100,45 +98,45 @@ void CameraProcess::GetCameraLocation(int32 &x, int32 &y, int32 &z) {
// Track item, do nothing
CameraProcess::CameraProcess(uint16 _itemnum) :
- _time(0), elapsed(0), itemnum(_itemnum), last_framenum(0) {
- GetCameraLocation(sx, sy, sz);
+ _time(0), _elapsed(0), _itemNum(_itemnum), _lastFrameNum(0) {
+ GetCameraLocation(_sx, _sy, _sz);
- if (itemnum) {
- Item *item = getItem(itemnum);
+ if (_itemNum) {
+ Item *item = getItem(_itemNum);
// Got it
if (item) {
item->setExtFlag(Item::EXT_CAMERA);
- item->getLocation(ex, ey, ez);
- ez += 20; //!!constant
+ item->getLocation(_ex, _ey, _ez);
+ _ez += 20; //!!constant
}
return;
}
// No item
- itemnum = 0;
- ex = sx;
- ey = sy;
- ez = sz;
+ _itemNum = 0;
+ _ex = _sx;
+ _ey = _sy;
+ _ez = _sz;
}
// Stay over point
CameraProcess::CameraProcess(int32 x_, int32 y_, int32 z_) :
- ex(x_), ey(y_), ez(z_), _time(0), elapsed(0), itemnum(0), last_framenum(0) {
- GetCameraLocation(sx, sy, sz);
+ _ex(x_), _ey(y_), _ez(z_), _time(0), _elapsed(0), _itemNum(0), _lastFrameNum(0) {
+ GetCameraLocation(_sx, _sy, _sz);
}
// Scroll
CameraProcess::CameraProcess(int32 x_, int32 y_, int32 z_, int32 time_) :
- ex(x_), ey(y_), ez(z_), _time(time_), elapsed(0), itemnum(0), last_framenum(0) {
- GetCameraLocation(sx, sy, sz);
+ _ex(x_), _ey(y_), _ez(z_), _time(time_), _elapsed(0), _itemNum(0), _lastFrameNum(0) {
+ GetCameraLocation(_sx, _sy, _sz);
//pout << "Scrolling from (" << sx << "," << sy << "," << sz << ") to (" <<
// ex << "," << ey << "," << ez << ") in " << _time << " frames" << Std::endl;
}
void CameraProcess::terminate() {
- if (itemnum) {
- Item *item = getItem(itemnum);
+ if (_itemNum) {
+ Item *item = getItem(_itemNum);
if (item) item->clearExtFlag(Item::EXT_CAMERA);
}
@@ -146,35 +144,35 @@ void CameraProcess::terminate() {
}
void CameraProcess::run() {
- if (earthquake) {
- eq_x = (getRandom() % (earthquake * 2 + 1)) - earthquake;
- eq_y = (getRandom() % (earthquake * 2 + 1)) - earthquake;
+ if (_earthquake) {
+ _eqX = (getRandom() % (_earthquake * 2 + 1)) - _earthquake;
+ _eqY = (getRandom() % (_earthquake * 2 + 1)) - _earthquake;
} else {
- eq_x = 0;
- eq_y = 0;
+ _eqX = 0;
+ _eqY = 0;
}
- if (_time && elapsed > _time) {
+ if (_time && _elapsed > _time) {
_result = 0; // do we need this
CameraProcess::SetCameraProcess(0); // This will terminate us
return;
}
- elapsed++;
+ _elapsed++;
}
void CameraProcess::ItemMoved() {
- if (itemnum) {
- Item *item = getItem(itemnum);
+ if (_itemNum) {
+ Item *item = getItem(_itemNum);
// We only update for now if lerping has been disabled
if (item && (item->getExtFlags() & Item::EXT_LERP_NOPREV)) {
- item->getLocation(ex, ey, ez);
- sx = ex;
- sy = ey;
- sz = ez += 20;
+ item->getLocation(_ex, _ey, _ez);
+ _sx = _ex;
+ _sy = _ey;
+ _sz = _ez += 20;
- World::get_instance()->getCurrentMap()->updateFastArea(sx, sy, sz, ex, ey, ez);
+ World::get_instance()->getCurrentMap()->updateFastArea(_sx, _sy, _sz, _ex, _ey, _ez);
}
}
}
@@ -185,63 +183,63 @@ void CameraProcess::GetLerped(int32 &x, int32 &y, int32 &z, int32 factor, bool n
bool inBetween = true;
- if (last_framenum != elapsed) {
+ if (_lastFrameNum != _elapsed) {
// No lerping if we missed a frame
- if ((elapsed - last_framenum) > 1) factor = 256;
- last_framenum = elapsed;
+ if ((_elapsed - _lastFrameNum) > 1) factor = 256;
+ _lastFrameNum = _elapsed;
inBetween = false;
}
if (!inBetween) {
- sx = ex;
- sy = ey;
- sz = ez;
+ _sx = _ex;
+ _sy = _ey;
+ _sz = _ez;
- if (itemnum) {
- Item *item = getItem(itemnum);
+ if (_itemNum) {
+ Item *item = getItem(_itemNum);
// Got it
if (item) {
- sx = ex;
- sy = ey;
- sz = ez;
- item->getLocation(ex, ey, ez);
- ez += 20; //!!constant
+ _sx = _ex;
+ _sy = _ey;
+ _sz = _ez;
+ item->getLocation(_ex, _ey, _ez);
+ _ez += 20; //!!constant
}
}
// Update the fast area
- World::get_instance()->getCurrentMap()->updateFastArea(sx, sy, sz, ex, ey, ez);
+ World::get_instance()->getCurrentMap()->updateFastArea(_sx, _sy, _sz, _ex, _ey, _ez);
}
}
if (factor == 256) {
- x = ex;
- y = ey;
- z = ez;
+ x = _ex;
+ y = _ey;
+ z = _ez;
} else if (factor == 0) {
- x = sx;
- y = sy;
- z = sz;
+ x = _sx;
+ y = _sy;
+ z = _sz;
} else {
// This way while possibly slower is more accurate
- x = ((sx * (256 - factor) + ex * factor) >> 8);
- y = ((sy * (256 - factor) + ey * factor) >> 8);
- z = ((sz * (256 - factor) + ez * factor) >> 8);
+ x = ((_sx * (256 - factor) + _ex * factor) >> 8);
+ y = ((_sy * (256 - factor) + _ey * factor) >> 8);
+ z = ((_sz * (256 - factor) + _ez * factor) >> 8);
}
} else {
// Do a quadratic interpolation here of velocity (maybe), but not yet
- int32 sfactor = elapsed;
- int32 efactor = elapsed + 1;
+ int32 sfactor = _elapsed;
+ int32 efactor = _elapsed + 1;
if (sfactor > _time) sfactor = _time;
if (efactor > _time) efactor = _time;
- int32 lsx = ((sx * (_time - sfactor) + ex * sfactor) / _time);
- int32 lsy = ((sy * (_time - sfactor) + ey * sfactor) / _time);
- int32 lsz = ((sz * (_time - sfactor) + ez * sfactor) / _time);
+ int32 lsx = ((_sx * (_time - sfactor) + _ex * sfactor) / _time);
+ int32 lsy = ((_sy * (_time - sfactor) + _ey * sfactor) / _time);
+ int32 lsz = ((_sz * (_time - sfactor) + _ez * sfactor) / _time);
- int32 lex = ((sx * (_time - efactor) + ex * efactor) / _time);
- int32 ley = ((sy * (_time - efactor) + ey * efactor) / _time);
- int32 lez = ((sz * (_time - efactor) + ez * efactor) / _time);
+ int32 lex = ((_sx * (_time - efactor) + _ex * efactor) / _time);
+ int32 ley = ((_sy * (_time - efactor) + _ey * efactor) / _time);
+ int32 lez = ((_sz * (_time - efactor) + _ez * efactor) / _time);
// Update the fast area
if (!noupdate) World::get_instance()->getCurrentMap()->updateFastArea(lsx, lsy, lsz, lex, ley, lez);
@@ -252,18 +250,18 @@ void CameraProcess::GetLerped(int32 &x, int32 &y, int32 &z, int32 factor, bool n
z = ((lsz * (256 - factor) + lez * factor) >> 8);
}
- if (earthquake) {
- x += 2 * eq_x + 4 * eq_y;
- y += -2 * eq_x + 4 * eq_y;
+ if (_earthquake) {
+ x += 2 * _eqX + 4 * _eqY;
+ y += -2 * _eqX + 4 * _eqY;
}
}
uint16 CameraProcess::FindRoof(int32 factor) {
int32 x, y, z;
- int32 earthquake_old = earthquake;
- earthquake = 0;
+ int32 earthquake_old = _earthquake;
+ _earthquake = 0;
GetLerped(x, y, z, factor);
- earthquake = earthquake_old;
+ _earthquake = earthquake_old;
Item *avatar = getItem(1);
int32 dx, dy, dz;
avatar->getFootpadWorld(dx, dy, dz);
@@ -275,39 +273,39 @@ uint16 CameraProcess::FindRoof(int32 factor) {
void CameraProcess::saveData(ODataSource *ods) {
Process::saveData(ods);
- ods->write4(static_cast<uint32>(sx));
- ods->write4(static_cast<uint32>(sy));
- ods->write4(static_cast<uint32>(sz));
- ods->write4(static_cast<uint32>(ex));
- ods->write4(static_cast<uint32>(ey));
- ods->write4(static_cast<uint32>(ez));
+ ods->write4(static_cast<uint32>(_sx));
+ ods->write4(static_cast<uint32>(_sy));
+ ods->write4(static_cast<uint32>(_sz));
+ ods->write4(static_cast<uint32>(_ex));
+ ods->write4(static_cast<uint32>(_ey));
+ ods->write4(static_cast<uint32>(_ez));
ods->write4(static_cast<uint32>(_time));
- ods->write4(static_cast<uint32>(elapsed));
- ods->write2(itemnum);
- ods->write4(last_framenum);
- ods->write4(static_cast<uint32>(earthquake));
- ods->write4(static_cast<uint32>(eq_x));
- ods->write4(static_cast<uint32>(eq_y));
+ ods->write4(static_cast<uint32>(_elapsed));
+ ods->write2(_itemNum);
+ ods->write4(_lastFrameNum);
+ ods->write4(static_cast<uint32>(_earthquake));
+ ods->write4(static_cast<uint32>(_eqX));
+ ods->write4(static_cast<uint32>(_eqY));
}
bool CameraProcess::loadData(IDataSource *ids, uint32 version) {
if (!Process::loadData(ids, version)) return false;
- sx = static_cast<int32>(ids->read4());
- sy = static_cast<int32>(ids->read4());
- sz = static_cast<int32>(ids->read4());
- ex = static_cast<int32>(ids->read4());
- ey = static_cast<int32>(ids->read4());
- ez = static_cast<int32>(ids->read4());
+ _sx = static_cast<int32>(ids->read4());
+ _sy = static_cast<int32>(ids->read4());
+ _sz = static_cast<int32>(ids->read4());
+ _ex = static_cast<int32>(ids->read4());
+ _ey = static_cast<int32>(ids->read4());
+ _ez = static_cast<int32>(ids->read4());
_time = static_cast<int32>(ids->read4());
- elapsed = static_cast<int32>(ids->read4());
- itemnum = ids->read2();
- last_framenum = ids->read4();
- earthquake = static_cast<int32>(ids->read4()); //static
- eq_x = static_cast<int32>(ids->read4()); //static
- eq_y = static_cast<int32>(ids->read4()); //static
+ _elapsed = static_cast<int32>(ids->read4());
+ _itemNum = ids->read2();
+ _lastFrameNum = ids->read4();
+ _earthquake = static_cast<int32>(ids->read4()); //static
+ _eqX = static_cast<int32>(ids->read4()); //static
+ _eqY = static_cast<int32>(ids->read4()); //static
- camera = this; //static
+ _camera = this; //static
return true;
}
@@ -324,8 +322,8 @@ uint32 CameraProcess::I_move_to(const uint8 *args, unsigned int /*argsize*/) {
// "Camera::setCenterOn(uword)",
uint32 CameraProcess::I_setCenterOn(const uint8 *args, unsigned int /*argsize*/) {
- ARG_OBJID(itemnum);
- CameraProcess::SetCameraProcess(new CameraProcess(itemnum));
+ ARG_OBJID(_itemNum);
+ CameraProcess::SetCameraProcess(new CameraProcess(_itemNum));
return 0;
}
diff --git a/engines/ultima/ultima8/world/camera_process.h b/engines/ultima/ultima8/world/camera_process.h
index dd522ff..505585b 100644
--- a/engines/ultima/ultima8/world/camera_process.h
+++ b/engines/ultima/ultima8/world/camera_process.h
@@ -69,14 +69,14 @@ public:
static void GetCameraLocation(int32 &x, int32 &y, int32 &z);
static CameraProcess *GetCameraProcess() {
- return camera;
+ return _camera;
}
static uint16 SetCameraProcess(CameraProcess *); // Set the current camera process. Adds process. Return PID
static void ResetCameraProcess();
static void SetEarthquake(int32 e) {
- earthquake = e;
- if (!e) eq_x = eq_y = 0;
+ _earthquake = e;
+ if (!e) _eqX = _eqY = 0;
}
void ItemMoved();
@@ -87,17 +87,17 @@ public:
private:
void saveData(ODataSource *ods) override;
- int32 sx, sy, sz;
- int32 ex, ey, ez;
+ int32 _sx, _sy, _sz;
+ int32 _ex, _ey, _ez;
int32 _time;
- int32 elapsed;
- uint16 itemnum;
+ int32 _elapsed;
+ uint16 _itemNum;
- int32 last_framenum;
+ int32 _lastFrameNum;
- static CameraProcess *camera;
- static int32 earthquake;
- static int32 eq_x, eq_y;
+ static CameraProcess *_camera;
+ static int32 _earthquake;
+ static int32 _eqX, _eqY;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/container.cpp b/engines/ultima/ultima8/world/container.cpp
index 563430d..151291c 100644
--- a/engines/ultima/ultima8/world/container.cpp
+++ b/engines/ultima/ultima8/world/container.cpp
@@ -48,15 +48,15 @@ Container::Container() {
Container::~Container() {
- // TODO: handle container's contents.
- // Either destroy the contents, or move them up to this container's parent?
+ // TODO: handle container's _contents.
+ // Either destroy the _contents, or move them up to this container's parent?
// if we don't have an _objId, we _must_ delete children
if (_objId == 0xFFFF) {
Std::list<Item *>::iterator iter;
- for (iter = contents.begin(); iter != contents.end(); ++iter) {
+ for (iter = _contents.begin(); iter != _contents.end(); ++iter) {
delete(*iter);
}
}
@@ -67,7 +67,7 @@ ObjId Container::assignObjId() {
ObjId id = Item::assignObjId();
Std::list<Item *>::iterator iter;
- for (iter = contents.begin(); iter != contents.end(); ++iter) {
+ for (iter = _contents.begin(); iter != _contents.end(); ++iter) {
(*iter)->assignObjId();
(*iter)->setParent(id);
}
@@ -79,7 +79,7 @@ void Container::clearObjId() {
Item::clearObjId();
Std::list<Item *>::iterator iter;
- for (iter = contents.begin(); iter != contents.end(); ++iter) {
+ for (iter = _contents.begin(); iter != _contents.end(); ++iter) {
// make sure we don't clear the ObjId of an Actor
assert((*iter)->getObjId() >= 256);
@@ -150,7 +150,7 @@ bool Container::addItem(Item *item, bool checkwghtvol) {
if (!CanAddItem(item, checkwghtvol)) return false;
if (item->getParent() == _objId) return true; // already in here
- contents.push_back(item);
+ _contents.push_back(item);
return true;
}
@@ -158,9 +158,9 @@ bool Container::addItem(Item *item, bool checkwghtvol) {
bool Container::removeItem(Item *item) {
Std::list<Item *>::iterator iter;
- for (iter = contents.begin(); iter != contents.end(); ++iter) {
+ for (iter = _contents.begin(); iter != _contents.end(); ++iter) {
if (*iter == item) {
- contents.erase(iter);
+ _contents.erase(iter);
return true;
}
}
@@ -170,11 +170,11 @@ bool Container::removeItem(Item *item) {
bool Container::moveItemToEnd(Item *item) {
Std::list<Item *>::iterator iter;
- for (iter = contents.begin(); iter != contents.end(); ++iter) {
+ for (iter = _contents.begin(); iter != _contents.end(); ++iter) {
if (*iter == item) {
// found; move to end
- contents.erase(iter);
- contents.push_back(item);
+ _contents.erase(iter);
+ _contents.push_back(item);
return true;
}
}
@@ -189,15 +189,15 @@ void Container::removeContents() {
Container *parentCon = getParentAsContainer();
if (parentCon) {
- // move contents to parent
- while (contents.begin() != contents.end()) {
- Item *item = *(contents.begin());
+ // move _contents to parent
+ while (_contents.begin() != _contents.end()) {
+ Item *item = *(_contents.begin());
item->moveToContainer(parentCon);
}
} else {
- // move contents to our coordinates
- while (contents.begin() != contents.end()) {
- Item *item = *(contents.begin());
+ // move _contents to our coordinates
+ while (_contents.begin() != _contents.end()) {
+ Item *item = *(_contents.begin());
item->move(x, y, z);
}
}
@@ -205,8 +205,8 @@ void Container::removeContents() {
void Container::destroyContents() {
- while (contents.begin() != contents.end()) {
- Item *item = *(contents.begin());
+ while (_contents.begin() != _contents.end()) {
+ Item *item = *(_contents.begin());
Container *cont = p_dynamic_cast<Container *>(item);
if (cont) cont->destroyContents();
item->destroy(true); // we destroy the item immediately
@@ -217,7 +217,7 @@ void Container::setFlagRecursively(uint32 mask) {
setFlag(mask);
Std::list<Item *>::iterator iter;
- for (iter = contents.begin(); iter != contents.end(); ++iter) {
+ for (iter = _contents.begin(); iter != _contents.end(); ++iter) {
(*iter)->setFlag(mask);
Container *cont = p_dynamic_cast<Container *>(*iter);
if (cont) cont->setFlagRecursively(mask);
@@ -225,8 +225,8 @@ void Container::setFlagRecursively(uint32 mask) {
}
void Container::destroy(bool delnow) {
- //! What do we do with our contents?
- //! (in Exult we remove the contents)
+ //! What do we do with our _contents?
+ //! (in Exult we remove the _contents)
removeContents();
@@ -238,7 +238,7 @@ uint32 Container::getTotalWeight() {
// CONSTANT!
if (GAME_IS_U8 && getShape() == 79) {
- // contents of keyring don't weigh anything
+ // _contents of keyring don't weigh anything
return weight;
}
@@ -250,7 +250,7 @@ uint32 Container::getTotalWeight() {
Std::list<Item *>::iterator iter;
- for (iter = contents.begin(); iter != contents.end(); ++iter) {
+ for (iter = _contents.begin(); iter != _contents.end(); ++iter) {
weight += (*iter)->getTotalWeight();
}
@@ -268,7 +268,7 @@ uint32 Container::getContentVolume() {
Std::list<Item *>::iterator iter;
- for (iter = contents.begin(); iter != contents.end(); ++iter) {
+ for (iter = _contents.begin(); iter != _contents.end(); ++iter) {
volume += (*iter)->getVolume();
}
@@ -278,7 +278,7 @@ uint32 Container::getContentVolume() {
void Container::containerSearch(UCList *itemlist, const uint8 *loopscript,
uint32 scriptsize, bool recurse) {
Std::list<Item *>::iterator iter;
- for (iter = contents.begin(); iter != contents.end(); ++iter) {
+ for (iter = _contents.begin(); iter != _contents.end(); ++iter) {
// check item against loopscript
if ((*iter)->checkLoopScript(loopscript, scriptsize)) {
uint16 oId = (*iter)->getObjId();
@@ -307,9 +307,9 @@ void Container::dumpInfo() {
void Container::saveData(ODataSource *ods) {
Item::saveData(ods);
- ods->write4(static_cast<uint32>(contents.size()));
+ ods->write4(static_cast<uint32>(_contents.size()));
Std::list<Item *>::iterator iter;
- for (iter = contents.begin(); iter != contents.end(); ++iter) {
+ for (iter = _contents.begin(); iter != _contents.end(); ++iter) {
(*iter)->save(ods);
}
}
@@ -319,7 +319,7 @@ bool Container::loadData(IDataSource *ids, uint32 version) {
uint32 contentcount = ids->read4();
- // read contents
+ // read _contents
for (unsigned int i = 0; i < contentcount; ++i) {
Object *obj = ObjectManager::get_instance()->loadObject(ids, version);
Item *item = p_dynamic_cast<Item *>(obj);
diff --git a/engines/ultima/ultima8/world/container.h b/engines/ultima/ultima8/world/container.h
index 3a04b6c..97cbdd9 100644
--- a/engines/ultima/ultima8/world/container.h
+++ b/engines/ultima/ultima8/world/container.h
@@ -117,7 +117,7 @@ protected:
//! save Container data
void saveData(ODataSource *ods) override;
- Std::list<Item *> contents;
+ Std::list<Item *> _contents;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/create_item_process.cpp b/engines/ultima/ultima8/world/create_item_process.cpp
index 13a3588..ffec9a2 100644
--- a/engines/ultima/ultima8/world/create_item_process.cpp
+++ b/engines/ultima/ultima8/world/create_item_process.cpp
@@ -43,10 +43,10 @@ CreateItemProcess::CreateItemProcess(uint32 shape_, uint32 frame_,
uint16 quality_, uint16 flags_,
uint16 npcnum_, uint16 mapnum_,
uint32 extendedflags_,
- int32 x_, int32 y_, int32 z_)
- : shape(shape_), frame(frame_), quality(quality_), flags(flags_),
- npcnum(npcnum_), mapnum(mapnum_), extendedflags(extendedflags_),
- x(x_), y(y_), z(z_) {
+ int32 x, int32 y, int32 z)
+ : _shape(shape_), _frame(frame_), _quality(quality_), _flags(flags_),
+ _npcNum(npcnum_), _mapNum(mapnum_), _extendedFlags(extendedflags_),
+ _x(x), _y(y), _z(z) {
}
@@ -55,9 +55,9 @@ CreateItemProcess::~CreateItemProcess(void) {
}
void CreateItemProcess::run() {
- Item *item = ItemFactory::createItem(shape, frame, quality, flags,
- npcnum, mapnum, extendedflags, true);
- item->move(x, y, z);
+ Item *item = ItemFactory::createItem(_shape, _frame, _quality, _flags,
+ _npcNum, _mapNum, _extendedFlags, true);
+ item->move(_x, _y, _z);
_result = item->getObjId();
@@ -67,31 +67,31 @@ void CreateItemProcess::run() {
void CreateItemProcess::saveData(ODataSource *ods) {
Process::saveData(ods);
- ods->write4(shape);
- ods->write4(frame);
- ods->write2(quality);
- ods->write2(flags);
- ods->write2(npcnum);
- ods->write2(mapnum);
- ods->write4(extendedflags);
- ods->write4(static_cast<uint32>(x));
- ods->write4(static_cast<uint32>(y));
- ods->write4(static_cast<uint32>(z));
+ ods->write4(_shape);
+ ods->write4(_frame);
+ ods->write2(_quality);
+ ods->write2(_flags);
+ ods->write2(_npcNum);
+ ods->write2(_mapNum);
+ ods->write4(_extendedFlags);
+ ods->write4(static_cast<uint32>(_x));
+ ods->write4(static_cast<uint32>(_y));
+ ods->write4(static_cast<uint32>(_z));
}
bool CreateItemProcess::loadData(IDataSource *ids, uint32 version) {
if (!Process::loadData(ids, version)) return false;
- shape = ids->read4();
- frame = ids->read4();
- quality = ids->read2();
- flags = ids->read2();
- npcnum = ids->read2();
- mapnum = ids->read2();
- extendedflags = ids->read4();
- x = static_cast<int32>(ids->read4());
- y = static_cast<int32>(ids->read4());
- z = static_cast<int32>(ids->read4());
+ _shape = ids->read4();
+ _frame = ids->read4();
+ _quality = ids->read2();
+ _flags = ids->read2();
+ _npcNum = ids->read2();
+ _mapNum = ids->read2();
+ _extendedFlags = ids->read4();
+ _x = static_cast<int32>(ids->read4());
+ _y = static_cast<int32>(ids->read4());
+ _z = static_cast<int32>(ids->read4());
return true;
}
diff --git a/engines/ultima/ultima8/world/create_item_process.h b/engines/ultima/ultima8/world/create_item_process.h
index aae553b..4b3471b 100644
--- a/engines/ultima/ultima8/world/create_item_process.h
+++ b/engines/ultima/ultima8/world/create_item_process.h
@@ -46,14 +46,14 @@ public:
protected:
void saveData(ODataSource *ods) override;
- uint32 shape;
- uint32 frame;
- uint16 quality;
- uint16 flags;
- uint16 npcnum;
- uint16 mapnum;
- uint32 extendedflags;
- int32 x, y, z;
+ uint32 _shape;
+ uint32 _frame;
+ uint16 _quality;
+ uint16 _flags;
+ uint16 _npcNum;
+ uint16 _mapNum;
+ uint32 _extendedFlags;
+ int32 _x, _y, _z;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/current_map.cpp b/engines/ultima/ultima8/world/current_map.cpp
index 33f2fe8..ac3df73 100644
--- a/engines/ultima/ultima8/world/current_map.cpp
+++ b/engines/ultima/ultima8/world/current_map.cpp
@@ -53,22 +53,20 @@ typedef list<Item *> item_list;
const int INT_MAX_VALUE = 0x7fffffff;
-CurrentMap::CurrentMap()
- : current_map(0), egghatcher(0),
- fast_x_min(-1), fast_y_min(-1),
- fast_x_max(-1), fast_y_max(-1) {
- items = new list<Item *> *[MAP_NUM_CHUNKS];
- fast = new uint32*[MAP_NUM_CHUNKS];
+CurrentMap::CurrentMap() : _currentMap(0), _eggHatcher(0),
+ _fastXMin(-1), _fastYMin(-1), _fastXMax(-1), _fastYMax(-1) {
+ _items = new list<Item *> *[MAP_NUM_CHUNKS];
+ _fast = new uint32*[MAP_NUM_CHUNKS];
for (unsigned int i = 0; i < MAP_NUM_CHUNKS; i++) {
- items[i] = new list<Item *>[MAP_NUM_CHUNKS];
- fast[i] = new uint32[MAP_NUM_CHUNKS / 32];
- Std::memset(fast[i], false, sizeof(uint32)*MAP_NUM_CHUNKS / 32);
+ _items[i] = new list<Item *>[MAP_NUM_CHUNKS];
+ _fast[i] = new uint32[MAP_NUM_CHUNKS / 32];
+ Std::memset(_fast[i], false, sizeof(uint32)*MAP_NUM_CHUNKS / 32);
}
if (GAME_IS_U8) {
- mapChunkSize = 512;
+ _mapChunkSize = 512;
} else if (GAME_IS_CRUSADER) {
- mapChunkSize = 1024;
+ _mapChunkSize = 1024;
} else {
CANT_HAPPEN_MSG("Unknown game type in CurrentMap constructor.");
}
@@ -79,64 +77,64 @@ CurrentMap::~CurrentMap() {
// clear();
for (unsigned int i = 0; i < MAP_NUM_CHUNKS; i++) {
- delete[] items[i];
- delete[] fast[i];
+ delete[] _items[i];
+ delete[] _fast[i];
}
- delete[] items;
- delete[] fast;
+ delete[] _items;
+ delete[] _fast;
}
void CurrentMap::clear() {
for (unsigned int i = 0; i < MAP_NUM_CHUNKS; i++) {
for (unsigned int j = 0; j < MAP_NUM_CHUNKS; j++) {
item_list::iterator iter;
- for (iter = items[i][j].begin(); iter != items[i][j].end(); ++iter)
+ for (iter = _items[i][j].begin(); iter != _items[i][j].end(); ++iter)
delete *iter;
- items[i][j].clear();
+ _items[i][j].clear();
}
- Std::memset(fast[i], false, sizeof(uint32)*MAP_NUM_CHUNKS / 32);
+ Std::memset(_fast[i], false, sizeof(uint32)*MAP_NUM_CHUNKS / 32);
}
- fast_x_min = fast_y_min = fast_x_max = fast_y_max = -1;
- current_map = 0;
+ _fastXMin = _fastYMin = _fastXMax = _fastYMax = -1;
+ _currentMap = 0;
- Process *ehp = Kernel::get_instance()->getProcess(egghatcher);
+ Process *ehp = Kernel::get_instance()->getProcess(_eggHatcher);
if (ehp)
ehp->terminate();
- egghatcher = 0;
+ _eggHatcher = 0;
}
uint32 CurrentMap::getNum() const {
- if (current_map == 0)
+ if (_currentMap == 0)
return 0;
- return current_map->mapnum;
+ return _currentMap->mapnum;
}
void CurrentMap::createEggHatcher() {
// get rid of old one, if any
- Process *ehp = Kernel::get_instance()->getProcess(egghatcher);
+ Process *ehp = Kernel::get_instance()->getProcess(_eggHatcher);
if (ehp)
ehp->terminate();
ehp = new EggHatcherProcess();
- egghatcher = Kernel::get_instance()->addProcess(ehp);
+ _eggHatcher = Kernel::get_instance()->addProcess(ehp);
}
void CurrentMap::writeback() {
- if (!current_map)
+ if (!_currentMap)
return;
for (unsigned int i = 0; i < MAP_NUM_CHUNKS; i++) {
for (unsigned int j = 0; j < MAP_NUM_CHUNKS; j++) {
item_list::iterator iter;
- for (iter = items[i][j].begin(); iter != items[i][j].end(); ++iter) {
+ for (iter = _items[i][j].begin(); iter != _items[i][j].end(); ++iter) {
Item *item = *iter;
// item is being removed from the CurrentMap item lists
item->clearExtFlag(Item::EXT_INCURMAP);
- // delete all fast only and disposable items
+ // delete all _fast only and disposable _items
if ((item->getFlags() & Item::FLG_FAST_ONLY) ||
(item->getFlags() & Item::FLG_DISPOSABLE)) {
delete item;
@@ -156,20 +154,20 @@ void CurrentMap::writeback() {
item->clearObjId();
if (item->getExtFlags() & Item::EXT_FIXED) {
// item came from fixed
- current_map->fixeditems.push_back(item);
+ _currentMap->fixeditems.push_back(item);
} else {
- current_map->dynamicitems.push_back(item);
+ _currentMap->dynamicitems.push_back(item);
}
}
- items[i][j].clear();
+ _items[i][j].clear();
}
}
- // delete egghatcher
- Process *ehp = Kernel::get_instance()->getProcess(egghatcher);
+ // delete _eggHatcher
+ Process *ehp = Kernel::get_instance()->getProcess(_eggHatcher);
if (ehp)
ehp->terminate();
- egghatcher = 0;
+ _eggHatcher = 0;
}
void CurrentMap::loadItems(list<Item *> itemlist, bool callCacheIn) {
@@ -179,7 +177,7 @@ void CurrentMap::loadItems(list<Item *> itemlist, bool callCacheIn) {
item->assignObjId();
- // No fast area for you!
+ // No _fast area for you!
item->clearFlag(Item::FLG_FASTAREA);
// add item to internal object list
@@ -192,25 +190,25 @@ void CurrentMap::loadItems(list<Item *> itemlist, bool callCacheIn) {
void CurrentMap::loadMap(Map *map) {
// don't call the cachein events at startup or when loading a savegame
- bool callCacheIn = (current_map != 0);
+ bool callCacheIn = (_currentMap != 0);
- current_map = map;
+ _currentMap = map;
createEggHatcher();
- // Clear fast area
+ // Clear _fast area
for (unsigned int i = 0; i < MAP_NUM_CHUNKS; i++) {
- Std::memset(fast[i], false, sizeof(uint32)*MAP_NUM_CHUNKS / 32);
+ Std::memset(_fast[i], false, sizeof(uint32)*MAP_NUM_CHUNKS / 32);
}
- fast_x_min = -1;
- fast_y_min = -1;
- fast_x_max = -1;
- fast_y_max = -1;
+ _fastXMin = -1;
+ _fastYMin = -1;
+ _fastXMax = -1;
+ _fastYMax = -1;
loadItems(map->fixeditems, callCacheIn);
loadItems(map->dynamicitems, callCacheIn);
- // we take control of the items in map, so clear the pointers
+ // we take control of the _items in map, so clear the pointers
map->fixeditems.clear();
map->dynamicitems.clear();
@@ -242,22 +240,22 @@ void CurrentMap::addItem(Item *item) {
item->getLocation(ix, iy, iz);
- if (ix < 0 || ix >= mapChunkSize * MAP_NUM_CHUNKS ||
- iy < 0 || iy >= mapChunkSize * MAP_NUM_CHUNKS) {
+ if (ix < 0 || ix >= _mapChunkSize * MAP_NUM_CHUNKS ||
+ iy < 0 || iy >= _mapChunkSize * MAP_NUM_CHUNKS) {
perr << "Skipping item " << item->getObjId() << ": out of range ("
<< ix << "," << iy << ")" << Std::endl;
return;
}
- int32 cx = ix / mapChunkSize;
- int32 cy = iy / mapChunkSize;
+ int32 cx = ix / _mapChunkSize;
+ int32 cy = iy / _mapChunkSize;
- items[cx][cy].push_front(item);
+ _items[cx][cy].push_front(item);
item->setExtFlag(Item::EXT_INCURMAP);
Egg *egg = p_dynamic_cast<Egg *>(item);
if (egg) {
- EggHatcherProcess *ehp = p_dynamic_cast<EggHatcherProcess *>(Kernel::get_instance()->getProcess(egghatcher));
+ EggHatcherProcess *ehp = p_dynamic_cast<EggHatcherProcess *>(Kernel::get_instance()->getProcess(_eggHatcher));
assert(ehp);
ehp->addEgg(egg);
}
@@ -268,22 +266,22 @@ void CurrentMap::addItemToEnd(Item *item) {
item->getLocation(ix, iy, iz);
- if (ix < 0 || ix >= mapChunkSize * MAP_NUM_CHUNKS ||
- iy < 0 || iy >= mapChunkSize * MAP_NUM_CHUNKS) {
+ if (ix < 0 || ix >= _mapChunkSize * MAP_NUM_CHUNKS ||
+ iy < 0 || iy >= _mapChunkSize * MAP_NUM_CHUNKS) {
perr << "Skipping item " << item->getObjId() << ": out of range ("
<< ix << "," << iy << ")" << Std::endl;
return;
}
- int32 cx = ix / mapChunkSize;
- int32 cy = iy / mapChunkSize;
+ int32 cx = ix / _mapChunkSize;
+ int32 cy = iy / _mapChunkSize;
- items[cx][cy].push_back(item);
+ _items[cx][cy].push_back(item);
item->setExtFlag(Item::EXT_INCURMAP);
Egg *egg = p_dynamic_cast<Egg *>(item);
if (egg) {
- EggHatcherProcess *ehp = p_dynamic_cast<EggHatcherProcess *>(Kernel::get_instance()->getProcess(egghatcher));
+ EggHatcherProcess *ehp = p_dynamic_cast<EggHatcherProcess *>(Kernel::get_instance()->getProcess(_eggHatcher));
assert(ehp);
ehp->addEgg(egg);
}
@@ -303,29 +301,29 @@ void CurrentMap::removeItemFromList(Item *item, int32 oldx, int32 oldy) {
// if it's really a problem we could change the item lists into sets
// or something, but let's see how it turns out
- if (oldx < 0 || oldx >= mapChunkSize * MAP_NUM_CHUNKS ||
- oldy < 0 || oldy >= mapChunkSize * MAP_NUM_CHUNKS) {
+ if (oldx < 0 || oldx >= _mapChunkSize * MAP_NUM_CHUNKS ||
+ oldy < 0 || oldy >= _mapChunkSize * MAP_NUM_CHUNKS) {
perr << "Skipping item " << item->getObjId() << ": out of range ("
<< oldx << "," << oldy << ")" << Std::endl;
return;
}
- int32 cx = oldx / mapChunkSize;
- int32 cy = oldy / mapChunkSize;
+ int32 cx = oldx / _mapChunkSize;
+ int32 cy = oldy / _mapChunkSize;
- items[cx][cy].remove(item);
+ _items[cx][cy].remove(item);
item->clearExtFlag(Item::EXT_INCURMAP);
}
// Check to see if the chunk is on the screen
-static inline bool ChunkOnScreen(int32 cx, int32 cy, int32 sleft, int32 stop, int32 sright, int32 sbot, int mapChunkSize) {
- int32 scx = (cx * mapChunkSize - cy * mapChunkSize) / 4;
- int32 scy = ((cx * mapChunkSize + cy * mapChunkSize) / 8);
+static inline bool ChunkOnScreen(int32 cx, int32 cy, int32 sleft, int32 stop, int32 sright, int32 sbot, int _mapChunkSize) {
+ int32 scx = (cx * _mapChunkSize - cy * _mapChunkSize) / 4;
+ int32 scy = ((cx * _mapChunkSize + cy * _mapChunkSize) / 8);
// Screenspace bounding box left extent (LNT x coord)
- int32 cxleft = scx - mapChunkSize / 4;
+ int32 cxleft = scx - _mapChunkSize / 4;
// Screenspace bounding box right extent (RFT x coord)
- int32 cxright = scx + mapChunkSize / 4;
+ int32 cxright = scx + _mapChunkSize / 4;
// Screenspace bounding box top extent (LFT y coord)
int32 cytop = scy - 256;
@@ -383,21 +381,21 @@ void CurrentMap::updateFastArea(int32 from_x, int32 from_y, int32 from_z, int32
Rect dims;
Ultima8Engine::get_instance()->getGameMapGump()->GetDims(dims);
- int32 sleft = ((x_min - y_min) / 4) - (dims.w / 2 + mapChunkSize / 4);
- int32 stop = ((x_min + y_min) / 8 - z_max) - (dims.h / 2 + mapChunkSize / 8);
- int32 sright = ((x_max - y_max) / 4) + (dims.w / 2 + mapChunkSize / 4);
- int32 sbot = ((x_max + y_max) / 8 - z_min) + (dims.h / 2 + mapChunkSize / 8);
+ int32 sleft = ((x_min - y_min) / 4) - (dims.w / 2 + _mapChunkSize / 4);
+ int32 stop = ((x_min + y_min) / 8 - z_max) - (dims.h / 2 + _mapChunkSize / 8);
+ int32 sright = ((x_max - y_max) / 4) + (dims.w / 2 + _mapChunkSize / 4);
+ int32 sbot = ((x_max + y_max) / 8 - z_min) + (dims.h / 2 + _mapChunkSize / 8);
// Don't do anything IF the regions are the same
- if (fast_x_min == sleft && fast_y_min == stop &&
- fast_x_max == sright && fast_y_max == sbot)
+ if (_fastXMin == sleft && _fastYMin == stop &&
+ _fastXMax == sright && _fastYMax == sbot)
return;
// Update the saved region
- fast_x_min = sleft;
- fast_y_min = stop;
- fast_x_max = sright;
- fast_y_max = sbot;
+ _fastXMin = sleft;
+ _fastYMin = stop;
+ _fastXMax = sright;
+ _fastYMax = sbot;
// Get Coarse Limits
int32 sx_limit;
@@ -406,10 +404,10 @@ void CurrentMap::updateFastArea(int32 from_x, int32 from_y, int32 from_z, int32
CalcFastAreaLimits(sx_limit, sy_limit, xy_limit, dims);
- x_min = x_min / mapChunkSize - xy_limit;
- x_max = x_max / mapChunkSize + xy_limit;
- y_min = y_min / mapChunkSize - xy_limit;
- y_max = y_max / mapChunkSize + xy_limit;
+ x_min = x_min / _mapChunkSize - xy_limit;
+ x_max = x_max / _mapChunkSize + xy_limit;
+ y_min = y_min / _mapChunkSize - xy_limit;
+ y_max = y_max / _mapChunkSize + xy_limit;
for (int32 cy = 0; cy < MAP_NUM_CHUNKS; cy++) {
for (int32 cx = 0; cx < MAP_NUM_CHUNKS; cx++) {
@@ -418,36 +416,36 @@ void CurrentMap::updateFastArea(int32 from_x, int32 from_y, int32 from_z, int32
bool want_fast = cx >= x_min && cx <= x_max && cy >= y_min && cy <= y_max;
// Fine
- if (want_fast) want_fast = ChunkOnScreen(cx, cy, sleft, stop, sright, sbot, mapChunkSize);
+ if (want_fast) want_fast = ChunkOnScreen(cx, cy, sleft, stop, sright, sbot, _mapChunkSize);
bool currently_fast = isChunkFast(cx, cy);
// Don't do anything, they are the same
if (want_fast == currently_fast) continue;
- // leave fast area
+ // leave _fast area
if (!want_fast) unsetChunkFast(cx, cy);
- // Enter fast area
+ // Enter _fast area
else setChunkFast(cx, cy);
}
}
}
void CurrentMap::setChunkFast(int32 cx, int32 cy) {
- fast[cy][cx / 32] |= 1 << (cx & 31);
+ _fast[cy][cx / 32] |= 1 << (cx & 31);
item_list::iterator iter;
- for (iter = items[cx][cy].begin();
- iter != items[cx][cy].end(); ++iter) {
+ for (iter = _items[cx][cy].begin();
+ iter != _items[cx][cy].end(); ++iter) {
(*iter)->enterFastArea();
}
}
void CurrentMap::unsetChunkFast(int32 cx, int32 cy) {
- fast[cy][cx / 32] &= ~(1 << (cx & 31));
+ _fast[cy][cx / 32] &= ~(1 << (cx & 31));
- item_list::iterator iter = items[cx][cy].begin();
- while (iter != items[cx][cy].end()) {
+ item_list::iterator iter = _items[cx][cy].begin();
+ while (iter != _items[cx][cy].end()) {
Item *item = *iter;
++iter;
item->leaveFastArea(); // Can destroy the item
@@ -471,10 +469,10 @@ void CurrentMap::areaSearch(UCList *itemlist, const uint8 *loopscript,
int minx, miny, maxx, maxy;
- minx = ((x - xd - range) / mapChunkSize) - 1;
- maxx = ((x + range) / mapChunkSize) + 1;
- miny = ((y - yd - range) / mapChunkSize) - 1;
- maxy = ((y + range) / mapChunkSize) + 1;
+ minx = ((x - xd - range) / _mapChunkSize) - 1;
+ maxx = ((x + range) / _mapChunkSize) + 1;
+ miny = ((y - yd - range) / _mapChunkSize) - 1;
+ maxy = ((y + range) / _mapChunkSize) + 1;
if (minx < 0) minx = 0;
if (maxx >= MAP_NUM_CHUNKS) maxx = MAP_NUM_CHUNKS - 1;
if (miny < 0) miny = 0;
@@ -483,8 +481,8 @@ void CurrentMap::areaSearch(UCList *itemlist, const uint8 *loopscript,
for (int cx = minx; cx <= maxx; cx++) {
for (int cy = miny; cy <= maxy; cy++) {
item_list::iterator iter;
- for (iter = items[cx][cy].begin();
- iter != items[cx][cy].end(); ++iter) {
+ for (iter = _items[cx][cy].begin();
+ iter != _items[cx][cy].end(); ++iter) {
Item *item = *iter;
@@ -551,10 +549,10 @@ void CurrentMap::surfaceSearch(UCList *itemlist, const uint8 *loopscript,
int32 minx, miny, maxx, maxy;
- minx = ((origin[0] - dims[0]) / mapChunkSize) - 1;
- maxx = ((origin[0]) / mapChunkSize) + 1;
- miny = ((origin[1] - dims[1]) / mapChunkSize) - 1;
- maxy = ((origin[1]) / mapChunkSize) + 1;
+ minx = ((origin[0] - dims[0]) / _mapChunkSize) - 1;
+ maxx = ((origin[0]) / _mapChunkSize) + 1;
+ miny = ((origin[1] - dims[1]) / _mapChunkSize) - 1;
+ maxy = ((origin[1]) / _mapChunkSize) + 1;
if (minx < 0) minx = 0;
if (maxx >= MAP_NUM_CHUNKS) maxx = MAP_NUM_CHUNKS - 1;
if (miny < 0) miny = 0;
@@ -563,8 +561,8 @@ void CurrentMap::surfaceSearch(UCList *itemlist, const uint8 *loopscript,
for (int32 cx = minx; cx <= maxx; cx++) {
for (int32 cy = miny; cy <= maxy; cy++) {
item_list::iterator iter;
- for (iter = items[cx][cy].begin();
- iter != items[cx][cy].end(); ++iter) {
+ for (iter = _items[cx][cy].begin();
+ iter != _items[cx][cy].end(); ++iter) {
Item *item = *iter;
@@ -616,8 +614,8 @@ TeleportEgg *CurrentMap::findDestination(uint16 id) {
for (unsigned int i = 0; i < MAP_NUM_CHUNKS; i++) {
for (unsigned int j = 0; j < MAP_NUM_CHUNKS; j++) {
item_list::iterator iter;
- for (iter = items[i][j].begin();
- iter != items[i][j].end(); ++iter) {
+ for (iter = _items[i][j].begin();
+ iter != _items[i][j].end(); ++iter) {
TeleportEgg *egg = p_dynamic_cast<TeleportEgg *>(*iter);
if (egg) {
if (!egg->isTeleporter() && egg->getTeleportId() == id)
@@ -673,10 +671,10 @@ bool CurrentMap::isValidPosition(int32 x, int32 y, int32 z,
int minx, miny, maxx, maxy;
- minx = ((x - xd) / mapChunkSize) - 1;
- maxx = (x / mapChunkSize) + 1;
- miny = ((y - yd) / mapChunkSize) - 1;
- maxy = (y / mapChunkSize) + 1;
+ minx = ((x - xd) / _mapChunkSize) - 1;
+ maxx = (x / _mapChunkSize) + 1;
+ miny = ((y - yd) / _mapChunkSize) - 1;
+ maxy = (y / _mapChunkSize) + 1;
if (minx < 0) minx = 0;
if (maxx >= MAP_NUM_CHUNKS) maxx = MAP_NUM_CHUNKS - 1;
if (miny < 0) miny = 0;
@@ -685,8 +683,8 @@ bool CurrentMap::isValidPosition(int32 x, int32 y, int32 z,
for (int cx = minx; cx <= maxx; cx++) {
for (int cy = miny; cy <= maxy; cy++) {
item_list::iterator iter;
- for (iter = items[cx][cy].begin();
- iter != items[cx][cy].end(); ++iter) {
+ for (iter = _items[cx][cy].begin();
+ iter != _items[cx][cy].end(); ++iter) {
Item *item = *iter;
if (item->getObjId() == item_) continue;
if (item->getExtFlags() & Item::EXT_SPRITE) continue;
@@ -791,10 +789,10 @@ bool CurrentMap::scanForValidPosition(int32 x, int32 y, int32 z, Item *item,
int minx, miny, maxx, maxy;
- minx = ((x - xd) / mapChunkSize) - 1;
- maxx = (x / mapChunkSize) + 1;
- miny = ((y - yd) / mapChunkSize) - 1;
- maxy = (y / mapChunkSize) + 1;
+ minx = ((x - xd) / _mapChunkSize) - 1;
+ maxx = (x / _mapChunkSize) + 1;
+ miny = ((y - yd) / _mapChunkSize) - 1;
+ maxy = (y / _mapChunkSize) + 1;
if (minx < 0) minx = 0;
if (maxx >= MAP_NUM_CHUNKS) maxx = MAP_NUM_CHUNKS - 1;
if (miny < 0) miny = 0;
@@ -803,8 +801,8 @@ bool CurrentMap::scanForValidPosition(int32 x, int32 y, int32 z, Item *item,
for (int cx = minx; cx <= maxx; cx++) {
for (int cy = miny; cy <= maxy; cy++) {
item_list::iterator iter;
- for (iter = items[cx][cy].begin();
- iter != items[cx][cy].end(); ++iter) {
+ for (iter = _items[cx][cy].begin();
+ iter != _items[cx][cy].end(); ++iter) {
Item *citem = *iter;
if (citem->getObjId() == item->getObjId()) continue;
if (citem->getExtFlags() & Item::EXT_SPRITE) continue;
@@ -918,8 +916,8 @@ bool CurrentMap::scanForValidPosition(int32 x, int32 y, int32 z, Item *item,
// Do a sweepTest of an item from start to end point.
// dims is the bounding box size.
// item is the item that we are checking to move
-// blocking_only forces us to check against blocking items only.
-// skip will skip all items until item num skip is reached
+// blocking_only forces us to check against blocking _items only.
+// skip will skip all _items until item num skip is reached
// Returns item hit or 0 if no hit.
// end is set to the colision point
bool CurrentMap::sweepTest(const int32 start[3], const int32 end[3],
@@ -931,17 +929,17 @@ bool CurrentMap::sweepTest(const int32 start[3], const int32 end[3],
int i;
int minx, miny, maxx, maxy;
- minx = ((start[0] - dims[0]) / mapChunkSize) - 1;
- maxx = (start[0] / mapChunkSize) + 1;
- miny = ((start[1] - dims[1]) / mapChunkSize) - 1;
- maxy = (start[1] / mapChunkSize) + 1;
+ minx = ((start[0] - dims[0]) / _mapChunkSize) - 1;
+ maxx = (start[0] / _mapChunkSize) + 1;
+ miny = ((start[1] - dims[1]) / _mapChunkSize) - 1;
+ maxy = (start[1] / _mapChunkSize) + 1;
{
int dminx, dminy, dmaxx, dmaxy;
- dminx = ((end[0] - dims[0]) / mapChunkSize) - 1;
- dmaxx = (end[0] / mapChunkSize) + 1;
- dminy = ((end[1] - dims[1]) / mapChunkSize) - 1;
- dmaxy = (end[1] / mapChunkSize) + 1;
+ dminx = ((end[0] - dims[0]) / _mapChunkSize) - 1;
+ dmaxx = (end[0] / _mapChunkSize) + 1;
+ dminy = ((end[1] - dims[1]) / _mapChunkSize) - 1;
+ dmaxy = (end[1] / _mapChunkSize) + 1;
if (dminx < minx) minx = dminx;
if (dmaxx > maxx) maxx = dmaxx;
if (dminy < miny) miny = dminy;
@@ -978,8 +976,8 @@ bool CurrentMap::sweepTest(const int32 start[3], const int32 end[3],
for (int cx = minx; cx <= maxx; cx++) {
for (int cy = miny; cy <= maxy; cy++) {
item_list::iterator iter;
- for (iter = items[cx][cy].begin();
- iter != items[cx][cy].end(); ++iter) {
+ for (iter = _items[cx][cy].begin();
+ iter != _items[cx][cy].end(); ++iter) {
Item *other_item = *iter;
if (other_item->getObjId() == item) continue;
if (other_item->getExtFlags() & Item::EXT_SPRITE) continue;
@@ -999,7 +997,7 @@ bool CurrentMap::sweepTest(const int32 start[3], const int32 end[3],
// If the objects overlapped at the start, ignore collision.
// The -1 and +1 portions are to still consider collisions
- // for items which were merely touching at the start for all
+ // for _items which were merely touching at the start for all
// intents and purposes, but partially overlapped due to an
// off-by-one error (hypothetically, but they do happen so
// protect against it).
@@ -1112,17 +1110,17 @@ bool CurrentMap::sweepTest(const int32 start[3], const int32 end[3],
if (last > 0x4000) last = 0x4000;
// Ok, what we want to do here is add to the list.
- // Sorted by hit_time.
+ // Sorted by _hitTime.
// Small speed up.
if (sw_it != hit->end()) {
SweepItem &si = *sw_it;
- if (si.hit_time > first) sw_it = hit->begin();
+ if (si._hitTime > first) sw_it = hit->begin();
} else
sw_it = hit->begin();
for (; sw_it != hit->end(); ++sw_it)
- if ((*sw_it).hit_time > first) break;
+ if ((*sw_it)._hitTime > first) break;
// Now add it
sw_it = hit->insert(sw_it, SweepItem(other_item->getObjId(), first, last, touch, touch_floor, blocking, dirs));
@@ -1150,10 +1148,10 @@ Item *CurrentMap::traceTopItem(int32 x, int32 y, int32 ztop, int32 zbot, ObjId i
}
int minx, miny, maxx, maxy;
- minx = (x / mapChunkSize);
- maxx = (x / mapChunkSize) + 1;
- miny = (y / mapChunkSize);
- maxy = (y / mapChunkSize) + 1;
+ minx = (x / _mapChunkSize);
+ maxx = (x / _mapChunkSize) + 1;
+ miny = (y / _mapChunkSize);
+ maxy = (y / _mapChunkSize) + 1;
if (minx < 0) minx = 0;
if (maxx >= MAP_NUM_CHUNKS) maxx = MAP_NUM_CHUNKS - 1;
if (miny < 0) miny = 0;
@@ -1162,8 +1160,8 @@ Item *CurrentMap::traceTopItem(int32 x, int32 y, int32 ztop, int32 zbot, ObjId i
for (int cx = minx; cx <= maxx; cx++) {
for (int cy = miny; cy <= maxy; cy++) {
item_list::iterator iter;
- for (iter = items[cx][cy].begin();
- iter != items[cx][cy].end(); ++iter) {
+ for (iter = _items[cx][cy].begin();
+ iter != _items[cx][cy].end(); ++iter) {
Item *item = *iter;
if (item->getObjId() == ignore) continue;
if (item->getExtFlags() & Item::EXT_SPRITE) continue;
@@ -1205,7 +1203,7 @@ void CurrentMap::setWholeMapFast() {
void CurrentMap::save(ODataSource *ods) {
for (unsigned int i = 0; i < MAP_NUM_CHUNKS; ++i) {
for (unsigned int j = 0; j < MAP_NUM_CHUNKS / 32; ++j) {
- ods->write4(fast[i][j]);
+ ods->write4(_fast[i][j]);
}
}
}
@@ -1213,14 +1211,14 @@ void CurrentMap::save(ODataSource *ods) {
bool CurrentMap::load(IDataSource *ids, uint32 version) {
for (unsigned int i = 0; i < MAP_NUM_CHUNKS; ++i) {
for (unsigned int j = 0; j < MAP_NUM_CHUNKS / 32; ++j) {
- fast[i][j] = ids->read4();
+ _fast[i][j] = ids->read4();
}
}
- fast_x_min = -1;
- fast_y_min = -1;
- fast_x_max = -1;
- fast_y_max = -1;
+ _fastXMin = -1;
+ _fastYMin = -1;
+ _fastXMax = -1;
+ _fastYMax = -1;
return true;
}
diff --git a/engines/ultima/ultima8/world/current_map.h b/engines/ultima/ultima8/world/current_map.h
index deca1a6..da97e45 100644
--- a/engines/ultima/ultima8/world/current_map.h
+++ b/engines/ultima/ultima8/world/current_map.h
@@ -52,14 +52,14 @@ public:
//! sets the currently loaded map, without any processing.
//! (Should only be used for loading.)
void setMap(Map *map) {
- current_map = map;
+ _currentMap = map;
}
//! Get the map number of the CurrentMap
uint32 getNum() const;
unsigned int getChunkSize() const {
- return mapChunkSize;
+ return _mapChunkSize;
}
//! Add an item to the beginning of the item list
@@ -133,10 +133,10 @@ public:
struct SweepItem {
SweepItem(ObjId it, int32 ht, int32 et, bool touch,
bool touchfloor, bool block, uint8 dir)
- : item(it), hit_time(ht), end_time(et), touching(touch),
- touching_floor(touchfloor), blocking(block), dirs(dir) { }
+ : _item(it), _hitTime(ht), _endTime(et), _touching(touch),
+ _touchingFloor(touchfloor), _blocking(block), _dirs(dir) { }
- ObjId item; // Item that was hit
+ ObjId _item; // Item that was hit
//
// The time values here are 'normalized' fixed point values
@@ -147,21 +147,21 @@ public:
// hit_time to find where the moving item was when the hit occurs
//
- int32 hit_time; // if -1, already hitting when sweep started.
- int32 end_time; // if 0x4000, still hitting when sweep finished
+ int32 _hitTime; // if -1, already hitting when sweep started.
+ int32 _endTime; // if 0x4000, still hitting when sweep finished
- bool touching; // We are only touching (don't actually overlap)
- bool touching_floor; // touching and directly below the moving item
+ bool _touching; // We are only touching (don't actually overlap)
+ bool _touchingFloor; // touching and directly below the moving item
- bool blocking; // This item blocks the moving item
+ bool _blocking; // This item blocks the moving item
- uint8 dirs; // Directions in which the item is being hit.
+ uint8 _dirs; // Directions in which the item is being hit.
// Bitmask. Bit 0 is x, 1 is y, 2 is z.
// Use this func to get the interpolated location of the hit
void GetInterpolatedCoords(int32 out[3], int32 start[3], int32 end[3]) {
for (int i = 0; i < 3; i++)
- out[i] = start[i] + ((end[i] - start[i]) * (hit_time >= 0 ? hit_time : 0) + (end[i] > start[i] ? 0x2000 : -0x2000)) / 0x4000;
+ out[i] = start[i] + ((end[i] - start[i]) * (_hitTime >= 0 ? _hitTime : 0) + (end[i] > start[i] ? 0x2000 : -0x2000)) / 0x4000;
}
};
@@ -188,14 +188,14 @@ public:
// CONSTANTS!
if (gx < 0 || gy < 0 || gx >= MAP_NUM_CHUNKS || gy >= MAP_NUM_CHUNKS)
return 0;
- return &items[gx][gy];
+ return &_items[gx][gy];
}
bool isChunkFast(int32 cx, int32 cy) {
// CONSTANTS!
if (cx < 0 || cy < 0 || cx >= MAP_NUM_CHUNKS || cy >= MAP_NUM_CHUNKS)
return false;
- return (fast[cy][cx / 32] & (1 << (cx & 31))) != 0;
+ return (_fast[cy][cx / 32] & (1 << (cx & 31))) != 0;
}
// A simple trace to find the top item at a specific xy point
@@ -213,19 +213,19 @@ private:
void loadItems(Std::list<Item *> itemlist, bool callCacheIn);
void createEggHatcher();
- Map *current_map;
+ Map *_currentMap;
// item lists. Lots of them :-)
// items[x][y]
- Std::list<Item *> **items;
+ Std::list<Item *> **_items;
- ProcId egghatcher;
+ ProcId _eggHatcher;
// Fast area bit masks -> fast[ry][rx/32]&(1<<(rx&31));
- uint32 **fast;
- int32 fast_x_min, fast_y_min, fast_x_max, fast_y_max;
+ uint32 **_fast;
+ int32 _fastXMin, _fastYMin, _fastXMax, _fastYMax;
- int mapChunkSize;
+ int _mapChunkSize;
void setChunkFast(int32 cx, int32 cy);
void unsetChunkFast(int32 cx, int32 cy);
diff --git a/engines/ultima/ultima8/world/item.cpp b/engines/ultima/ultima8/world/item.cpp
index afae47e..fd44030 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -882,9 +882,9 @@ int32 Item::collideMove(int32 dx, int32 dy, int32 dz, bool teleport, bool force,
if (!force) {
for (it = collisions.begin(); it != collisions.end(); it++) {
// Uh oh, we hit something, can't move
- if (it->end_time == 0x4000 && !it->touching && it->blocking) {
- if (hititem) *hititem = it->item;
- if (dirs) *dirs = it->dirs;
+ if (it->_endTime == 0x4000 && !it->_touching && it->_blocking) {
+ if (hititem) *hititem = it->_item;
+ if (dirs) *dirs = it->_dirs;
return 0;
}
}
@@ -893,15 +893,15 @@ int32 Item::collideMove(int32 dx, int32 dy, int32 dz, bool teleport, bool force,
// Trigger all the required events
bool we_were_released = false;
for (it = collisions.begin(); it != collisions.end(); it++) {
- Item *item = getItem(it->item);
+ Item *item = getItem(it->_item);
// Hitting us at the start and end, don't do anything
- if (!parent && it->hit_time == 0x0000 &&
- it->end_time == 0x4000) {
+ if (!parent && it->_hitTime == 0x0000 &&
+ it->_endTime == 0x4000) {
continue;
}
// Hitting us at the end (call hit on us, got hit on them)
- else if (it->end_time == 0x4000) {
+ else if (it->_endTime == 0x4000) {
if (_objId == 1 && guiapp->isShowTouchingItems())
item->setExtFlag(Item::EXT_HIGHLIGHT);
@@ -909,7 +909,7 @@ int32 Item::collideMove(int32 dx, int32 dy, int32 dz, bool teleport, bool force,
callUsecodeEvent_hit(item->getObjId(), hitforce);
}
// Hitting us at the start (call release on us and them)
- else if (!parent && it->hit_time == 0x0000) {
+ else if (!parent && it->_hitTime == 0x0000) {
if (_objId == 1) item->clearExtFlag(Item::EXT_HIGHLIGHT);
we_were_released = true;
item->callUsecodeEvent_release();
@@ -932,10 +932,10 @@ int32 Item::collideMove(int32 dx, int32 dy, int32 dz, bool teleport, bool force,
// We don't care about items hitting us at the start
if (!force) {
for (it = collisions.begin(); it != collisions.end(); it++) {
- if (it->blocking && !it->touching) {
- if (hititem) *hititem = it->item;
- if (dirs) *dirs = it->dirs;
- hit = it->hit_time;
+ if (it->_blocking && !it->_touching) {
+ if (hititem) *hititem = it->_item;
+ if (dirs) *dirs = it->_dirs;
+ hit = it->_hitTime;
break;
}
}
@@ -957,17 +957,17 @@ int32 Item::collideMove(int32 dx, int32 dy, int32 dz, bool teleport, bool force,
// Trigger all the required events
bool we_were_released = false;
for (it = collisions.begin(); it != collisions.end(); it++) {
- Item *item = getItem(it->item);
+ Item *item = getItem(it->_item);
if (!item) continue;
// Did we go past the endpoint of the move?
- if (it->hit_time > hit) break;
+ if (it->_hitTime > hit) break;
uint16 proc_gothit = 0, proc_rel = 0;
// If hitting at start, we should have already
// called gotHit and hit.
- if ((!it->touching || it->touching_floor) && it->hit_time >= 0) {
+ if ((!it->_touching || it->_touchingFloor) && it->_hitTime >= 0) {
if (_objId == 1 && guiapp->isShowTouchingItems())
item->setExtFlag(Item::EXT_HIGHLIGHT);
@@ -976,7 +976,7 @@ int32 Item::collideMove(int32 dx, int32 dy, int32 dz, bool teleport, bool force,
}
// If not hitting at end, we will need to call release
- if (it->end_time < hit) {
+ if (it->_endTime < hit) {
if (_objId == 1) item->clearExtFlag(Item::EXT_HIGHLIGHT);
we_were_released = true;
proc_rel = item->callUsecodeEvent_release();
@@ -1613,18 +1613,18 @@ static bool checkLineOfSightCollisions(
int32 blocked_time = 0x4000;
for (it = collisions.begin(); it != collisions.end(); it++) {
// ignore self and other
- if (it->item == item) continue;
- if (it->item == other && !usingAlternatePos) {
- other_hit_time = it->hit_time;
+ if (it->_item == item) continue;
+ if (it->_item == other && !usingAlternatePos) {
+ other_hit_time = it->_hitTime;
continue;
}
// only touching?
- if (it->touching) continue;
+ if (it->_touching) continue;
// hit something
- if (it->blocking && it->hit_time < blocked_time) {
- blocked_time = it->hit_time;
+ if (it->_blocking && it->_hitTime < blocked_time) {
+ blocked_time = it->_hitTime;
}
}
diff --git a/engines/ultima/ultima8/world/missile_tracker.cpp b/engines/ultima/ultima8/world/missile_tracker.cpp
index 06e73ec..4ffc083 100644
--- a/engines/ultima/ultima8/world/missile_tracker.cpp
+++ b/engines/ultima/ultima8/world/missile_tracker.cpp
@@ -157,8 +157,8 @@ bool MissileTracker::isPathClear() {
int32 hit = 0x4000;
for (it = collisions.begin(); it != collisions.end(); it++) {
- if (it->blocking && !it->touching) {
- hit = it->hit_time;
+ if (it->_blocking && !it->_touching) {
+ hit = it->_hitTime;
break;
}
}
diff --git a/engines/ultima/ultima8/world/world.cpp b/engines/ultima/ultima8/world/world.cpp
index c8357cf..16131b0 100644
--- a/engines/ultima/ultima8/world/world.cpp
+++ b/engines/ultima/ultima8/world/world.cpp
@@ -340,7 +340,7 @@ void World::worldStats() {
void World::save(ODataSource *ods) {
ods->write4(currentmap->getNum());
- ods->write2(currentmap->egghatcher);
+ ods->write2(currentmap->_eggHatcher);
uint16 es = static_cast<uint16>(ethereal.size());
ods->write4(es);
@@ -365,7 +365,7 @@ bool World::load(IDataSource *ids, uint32 version) {
uint16 curmapnum = ids->read4();
currentmap->setMap(maps[curmapnum]);
- currentmap->egghatcher = ids->read2();
+ currentmap->_eggHatcher = ids->read2();
uint32 etherealcount = ids->read4();
for (unsigned int i = 0; i < etherealcount; ++i) {
Commit: 3c320a414aa13e873cb0229be7f0e822af34c288
https://github.com/scummvm/scummvm/commit/3c320a414aa13e873cb0229be7f0e822af34c288
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-17T19:42:21-08:00
Commit Message:
ULTIMA8: Renaming more world folder class fields
Changed paths:
engines/ultima/ultima8/world/actors/actor.cpp
engines/ultima/ultima8/world/actors/main_actor.cpp
engines/ultima/ultima8/world/container.cpp
engines/ultima/ultima8/world/egg.cpp
engines/ultima/ultima8/world/egg.h
engines/ultima/ultima8/world/glob_egg.cpp
engines/ultima/ultima8/world/item.cpp
engines/ultima/ultima8/world/item.h
engines/ultima/ultima8/world/item_factory.cpp
engines/ultima/ultima8/world/monster_egg.cpp
engines/ultima/ultima8/world/monster_egg.h
engines/ultima/ultima8/world/teleport_egg.cpp
engines/ultima/ultima8/world/teleport_egg.h
diff --git a/engines/ultima/ultima8/world/actors/actor.cpp b/engines/ultima/ultima8/world/actors/actor.cpp
index 7055ae3..fd0b65d 100644
--- a/engines/ultima/ultima8/world/actors/actor.cpp
+++ b/engines/ultima/ultima8/world/actors/actor.cpp
@@ -427,9 +427,9 @@ void Actor::teleport(int newmap, int32 newx, int32 newy, int32 newz) {
// Move it to another map
else {
World::get_instance()->etherealRemove(_objId);
- x = newx;
- y = newy;
- z = newz;
+ _x = newx;
+ _y = newy;
+ _z = newz;
}
}
@@ -799,9 +799,9 @@ ProcId Actor::die(uint16 damageType) {
0, // mapnum
0, true // ext. flags, _objId
);
- piece->move(x - 128 + 32 * (getRandom() % 6),
- y - 128 + 32 * (getRandom() % 6),
- z + getRandom() % 8); // move to near actor's position
+ piece->move(_x - 128 + 32 * (getRandom() % 6),
+ _y - 128 + 32 * (getRandom() % 6),
+ _z + getRandom() % 8); // move to near actor's position
piece->hurl(-25 + (getRandom() % 50),
-25 + (getRandom() % 50),
10 + (getRandom() % 10),
diff --git a/engines/ultima/ultima8/world/actors/main_actor.cpp b/engines/ultima/ultima8/world/actors/main_actor.cpp
index 3a3dfe6..9fa2f51 100644
--- a/engines/ultima/ultima8/world/actors/main_actor.cpp
+++ b/engines/ultima/ultima8/world/actors/main_actor.cpp
@@ -66,9 +66,9 @@ MainActor::~MainActor() {
GravityProcess *MainActor::ensureGravityProcess() {
AvatarGravityProcess *p = 0;
- if (gravitypid) {
+ if (_gravityPid) {
p = p_dynamic_cast<AvatarGravityProcess *>(
- Kernel::get_instance()->getProcess(gravitypid));
+ Kernel::get_instance()->getProcess(_gravityPid));
} else {
p = new AvatarGravityProcess(this, 0);
Kernel::get_instance()->addProcess(p);
diff --git a/engines/ultima/ultima8/world/container.cpp b/engines/ultima/ultima8/world/container.cpp
index 151291c..c9f9d6f 100644
--- a/engines/ultima/ultima8/world/container.cpp
+++ b/engines/ultima/ultima8/world/container.cpp
@@ -198,7 +198,7 @@ void Container::removeContents() {
// move _contents to our coordinates
while (_contents.begin() != _contents.end()) {
Item *item = *(_contents.begin());
- item->move(x, y, z);
+ item->move(_x, _y, _z);
}
}
}
diff --git a/engines/ultima/ultima8/world/egg.cpp b/engines/ultima/ultima8/world/egg.cpp
index 7d4bca9..8a912f6 100644
--- a/engines/ultima/ultima8/world/egg.cpp
+++ b/engines/ultima/ultima8/world/egg.cpp
@@ -35,8 +35,7 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(Egg, Item)
-Egg::Egg() : hatched(false) {
-
+Egg::Egg() : _hatched(false) {
}
@@ -45,15 +44,15 @@ Egg::~Egg() {
}
uint16 Egg::hatch() {
- if (hatched) return 0;
- hatched = true;
+ if (_hatched) return 0;
+ _hatched = true;
return callUsecodeEvent_hatch();
}
void Egg::dumpInfo() {
Item::dumpInfo();
pout << "range: " << getXRange() << "," << getYRange()
- << ", hatched=" << hatched << Std::endl;
+ << ", hatched=" << _hatched << Std::endl;
}
void Egg::leaveFastArea() {
@@ -64,14 +63,14 @@ void Egg::leaveFastArea() {
void Egg::saveData(ODataSource *ods) {
Item::saveData(ods);
- uint8 h = hatched ? 1 : 0;
+ uint8 h = _hatched ? 1 : 0;
ods->write1(h);
}
bool Egg::loadData(IDataSource *ids, uint32 version) {
if (!Item::loadData(ids, version)) return false;
- hatched = (ids->read1() != 0);
+ _hatched = (ids->read1() != 0);
return true;
}
diff --git a/engines/ultima/ultima8/world/egg.h b/engines/ultima/ultima8/world/egg.h
index 10a7930..a15ffb7 100644
--- a/engines/ultima/ultima8/world/egg.h
+++ b/engines/ultima/ultima8/world/egg.h
@@ -37,19 +37,19 @@ public:
ENABLE_RUNTIME_CLASSTYPE()
int getXRange() const {
- return (npcnum >> 4) & 0xF;
+ return (_npcNum >> 4) & 0xF;
}
int getYRange() const {
- return npcnum & 0xF;
+ return _npcNum & 0xF;
}
void setXRange(int r) {
- npcnum &= 0x0F;
- npcnum |= (r & 0xF) << 4;
+ _npcNum &= 0x0F;
+ _npcNum |= (r & 0xF) << 4;
}
void setYRange(int r) {
- npcnum &= 0xF0;
- npcnum |= (r & 0xF);
+ _npcNum &= 0xF0;
+ _npcNum |= (r & 0xF);
}
//! hatch the egg
@@ -58,9 +58,9 @@ public:
//! The item has left the fast area
void leaveFastArea() override;
- //! clear the 'hatched' flag
+ //! clear the '_hatched' flag
void reset() {
- hatched = false;
+ _hatched = false;
}
void dumpInfo() override;
@@ -77,7 +77,7 @@ public:
protected:
void saveData(ODataSource *ods) override;
- bool hatched;
+ bool _hatched;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/glob_egg.cpp b/engines/ultima/ultima8/world/glob_egg.cpp
index 5b7e433..b284d4d 100644
--- a/engines/ultima/ultima8/world/glob_egg.cpp
+++ b/engines/ultima/ultima8/world/glob_egg.cpp
@@ -56,8 +56,8 @@ void GlobEgg::enterFastArea() {
}
// Expand it
- if (!(flags & FLG_FASTAREA)) {
- MapGlob *glob = GameData::get_instance()->getGlob(quality);
+ if (!(_flags & FLG_FASTAREA)) {
+ MapGlob *glob = GameData::get_instance()->getGlob(_quality);
if (!glob) return;
Std::vector<GlobItem>::iterator iter;
@@ -70,9 +70,9 @@ void GlobEgg::enterFastArea() {
// calculate object's world position
- int32 itemx = (x & coordmask) + (globitem.x << coordshift) + 1;
- int32 itemy = (y & coordmask) + (globitem.y << coordshift) + 1;
- int32 itemz = z + globitem.z;
+ int32 itemx = (_x & coordmask) + (globitem.x << coordshift) + 1;
+ int32 itemy = (_y & coordmask) + (globitem.y << coordshift) + 1;
+ int32 itemz = _z + globitem.z;
item->move(itemx, itemy, itemz);
}
diff --git a/engines/ultima/ultima8/world/item.cpp b/engines/ultima/ultima8/world/item.cpp
index fd44030..96d394a 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -21,7 +21,6 @@
*/
#include "ultima/ultima8/misc/pent_include.h"
-
#include "ultima/ultima8/world/item.h"
#include "ultima/ultima8/ultima8.h"
#include "ultima/ultima8/usecode/usecode.h"
@@ -71,30 +70,28 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(Item, Object)
Item::Item()
- : shape(0), frame(0), x(0), y(0), z(0),
- flags(0), quality(0), npcnum(0), mapnum(0),
- extendedflags(0), parent(0),
- cachedShape(0), cachedShapeInfo(0), gump(0), gravitypid(0),
- last_setup(0) {
-
+ : _shape(0), _frame(0), _x(0), _y(0), _z(0),
+ _flags(0), _quality(0), _npcNum(0), _mapNum(0),
+ _extendedFlags(0), _parent(0),
+ _cachedShape(0), _cachedShapeInfo(0), _gump(0), _gravityPid(0),
+ _lastSetup(0) {
}
Item::~Item() {
-
}
void Item::dumpInfo() {
pout << "Item " << getObjId() << " (class "
- << GetClassType()._className << ", shape "
+ << GetClassType()._className << ", _shape "
<< getShape() << ", " << getFrame() << ", (";
- if (parent) {
+ if (_parent) {
int32 gx, gy;
getGumpLocation(gx, gy);
pout << gx << "," << gy;
} else {
- pout << x << "," << y << "," << z;
+ pout << _x << "," << _y << "," << _z;
}
pout << ") q:" << getQuality()
@@ -104,13 +101,13 @@ void Item::dumpInfo() {
}
Container *Item::getParentAsContainer() const {
- // No parent, no container
- if (!parent) return 0;
+ // No _parent, no container
+ if (!_parent) return 0;
- Container *p = getContainer(parent);
+ Container *p = getContainer(_parent);
if (!p) {
- perr << "Item " << getObjId() << " parent (" << parent << ") is an invalid Container ObjID" << Std::endl;
+ perr << "Item " << getObjId() << " _parent (" << _parent << ") is an invalid Container ObjID" << Std::endl;
CANT_HAPPEN();
}
@@ -130,9 +127,9 @@ Item *Item::getTopItem() {
}
void Item::setLocation(int32 X, int32 Y, int32 Z) {
- x = X;
- y = Y;
- z = Z;
+ _x = X;
+ _y = Y;
+ _z = Z;
}
void Item::move(int32 X, int32 Y, int32 Z) {
@@ -145,52 +142,52 @@ void Item::move(int32 X, int32 Y, int32 Z) {
}
// It's currently in the ethereal void, remove it from there
- if (flags & FLG_ETHEREAL) {
+ if (_flags & FLG_ETHEREAL) {
// Remove us from the ethereal void
World::get_instance()->etherealRemove(_objId);
}
// Remove from container (if contained or equiped)
- if (flags & (FLG_CONTAINED | FLG_EQUIPPED)) {
- if (parent) {
+ if (_flags & (FLG_CONTAINED | FLG_EQUIPPED)) {
+ if (_parent) {
// If we are flagged as Ethereal, we are already removed
- if (!(flags & FLG_ETHEREAL)) {
+ if (!(_flags & FLG_ETHEREAL)) {
Container *p = getParentAsContainer();
if (p) p->removeItem(this);
}
} else
- perr << "Item " << getObjId() << " FLG_CONTAINED or FLG_EQUIPPED set but item has no parent" << Std::endl;
+ perr << "Item " << getObjId() << " FLG_CONTAINED or FLG_EQUIPPED set but item has no _parent" << Std::endl;
// Clear our owner.
- parent = 0;
+ _parent = 0;
// No lerping when going from a container to somewhere else
no_lerping = true;
}
// Item needs to be removed if it in the map, and it is moving to a
// different chunk
- else if ((extendedflags & EXT_INCURMAP) &&
- ((x / mapChunkSize != X / mapChunkSize) ||
- (y / mapChunkSize != Y / mapChunkSize))) {
+ else if ((_extendedFlags & EXT_INCURMAP) &&
+ ((_x / mapChunkSize != X / mapChunkSize) ||
+ (_y / mapChunkSize != Y / mapChunkSize))) {
// Remove us from the map
map->removeItem(this);
}
- // Unset all the various flags that no longer apply
- flags &= ~(FLG_CONTAINED | FLG_EQUIPPED | FLG_ETHEREAL);
+ // Unset all the various _flags that no longer apply
+ _flags &= ~(FLG_CONTAINED | FLG_EQUIPPED | FLG_ETHEREAL);
// Set the location
- x = X;
- y = Y;
- z = Z;
+ _x = X;
+ _y = Y;
+ _z = Z;
// Add it to the map if needed
- if (!(extendedflags & EXT_INCURMAP)) {
+ if (!(_extendedFlags & EXT_INCURMAP)) {
// Disposable fast only items get put at the end
// While normal items get put at start
- if (flags & (FLG_DISPOSABLE | FLG_FAST_ONLY))
+ if (_flags & (FLG_DISPOSABLE | FLG_FAST_ONLY))
map->addItemToEnd(this);
else
map->addItem(this);
@@ -203,14 +200,14 @@ void Item::move(int32 X, int32 Y, int32 Z) {
bool dest_fast = map->isChunkFast(X / mapChunkSize, Y / mapChunkSize);
// No lerping for this move
- if (no_lerping) extendedflags |= EXT_LERP_NOPREV;
+ if (no_lerping) _extendedFlags |= EXT_LERP_NOPREV;
// If the destination is not in the fast area, and we are in
// the fast area, we need to call leaveFastArea, as long as we aren't
// being followed by the camera. We also disable lerping in such a case
- if (!dest_fast && (flags & Item::FLG_FASTAREA)) {
- extendedflags |= EXT_LERP_NOPREV;
- if (extendedflags & EXT_CAMERA)
+ if (!dest_fast && (_flags & Item::FLG_FASTAREA)) {
+ _extendedFlags |= EXT_LERP_NOPREV;
+ if (_extendedFlags & EXT_CAMERA)
CameraProcess::GetCameraProcess()->ItemMoved();
else
leaveFastArea();
@@ -218,14 +215,14 @@ void Item::move(int32 X, int32 Y, int32 Z) {
return; //we are done
}
// Or if the dest is fast, and we are not, we need to call enterFastArea
- else if (dest_fast && !(flags & Item::FLG_FASTAREA)) {
- extendedflags |= EXT_LERP_NOPREV;
+ else if (dest_fast && !(_flags & Item::FLG_FASTAREA)) {
+ _extendedFlags |= EXT_LERP_NOPREV;
enterFastArea();
}
// If we are being followed, notify the camera that we moved
// Note that we don't need to
- if (extendedflags & EXT_CAMERA)
+ if (_extendedFlags & EXT_CAMERA)
CameraProcess::GetCameraProcess()->ItemMoved();
}
@@ -238,9 +235,9 @@ bool Item::moveToContainer(Container *container, bool checkwghtvol) {
// Already there, do nothing, but only if not ethereal
bool ethereal_same = false;
- if (container->getObjId() == parent) {
+ if (container->getObjId() == _parent) {
// If we are ethereal we'd like to know if we are just being moved back
- if (flags & FLG_ETHEREAL) ethereal_same = true;
+ if (_flags & FLG_ETHEREAL) ethereal_same = true;
else return true;
}
@@ -248,49 +245,49 @@ bool Item::moveToContainer(Container *container, bool checkwghtvol) {
if (!container->CanAddItem(this, checkwghtvol)) return false;
// It's currently in the ethereal void
- if (flags & FLG_ETHEREAL) {
+ if (_flags & FLG_ETHEREAL) {
// Remove us from the ethereal void
World::get_instance()->etherealRemove(_objId);
}
// Remove from container (if contained or equiped)
- if (flags & (FLG_CONTAINED | FLG_EQUIPPED)) {
- if (parent) {
+ if (_flags & (FLG_CONTAINED | FLG_EQUIPPED)) {
+ if (_parent) {
// If we are flagged as Ethereal, we are already removed
- if (!(flags & FLG_ETHEREAL)) {
+ if (!(_flags & FLG_ETHEREAL)) {
Container *p = getParentAsContainer();
if (p) p->removeItem(this);
}
} else
- perr << "Item " << getObjId() << " FLG_CONTAINED or FLG_EQUIPPED set but item has no parent" << Std::endl;
+ perr << "Item " << getObjId() << " FLG_CONTAINED or FLG_EQUIPPED set but item has no _parent" << Std::endl;
// Clear our owner.
- parent = 0;
+ _parent = 0;
}
// Item needs to be removed if it in the map
- else if (extendedflags & EXT_INCURMAP) {
+ else if (_extendedFlags & EXT_INCURMAP) {
// Remove us from the map
World::get_instance()->getCurrentMap()->removeItem(this);
}
- // Unset all the various flags that no longer apply
- flags &= ~(FLG_CONTAINED | FLG_EQUIPPED | FLG_ETHEREAL);
+ // Unset all the various _flags that no longer apply
+ _flags &= ~(FLG_CONTAINED | FLG_EQUIPPED | FLG_ETHEREAL);
// Set location to 0,0,0 if we aren't an ethereal item moving back
- if (!ethereal_same) x = y = 0;
- z = 0;
+ if (!ethereal_same) _x = _y = 0;
+ _z = 0;
// Add the item, don't bother with checking weight or vol since we already
// know if it will fit or not
container->addItem(this, false);
// Set our owner.
- parent = container->getObjId();
+ _parent = container->getObjId();
// Set us contained
- flags |= FLG_CONTAINED;
+ _flags |= FLG_CONTAINED;
// If moving to avatar, mark as OWNED
Item *p = this;
@@ -301,20 +298,20 @@ bool Item::moveToContainer(Container *container, bool checkwghtvol) {
setFlagRecursively(FLG_OWNED);
// No lerping when moving to a container
- extendedflags |= EXT_LERP_NOPREV;
+ _extendedFlags |= EXT_LERP_NOPREV;
// Call just moved
callUsecodeEvent_justMoved();
- // For a container, it's fast if it's got a gump open
- bool dest_fast = (container->flags & FLG_GUMP_OPEN) != 0;
+ // For a container, it's fast if it's got a _gump open
+ bool dest_fast = (container->_flags & FLG_GUMP_OPEN) != 0;
// If the destination is not in the fast area, and we are in
// the fast area, we need to call leaveFastArea
- if (!dest_fast && (flags & Item::FLG_FASTAREA))
+ if (!dest_fast && (_flags & Item::FLG_FASTAREA))
leaveFastArea();
// Or if the dest is fast, and we are not, we need to call enterFastArea
- else if (dest_fast && !(flags & Item::FLG_FASTAREA))
+ else if (dest_fast && !(_flags & Item::FLG_FASTAREA))
enterFastArea();
// Done
@@ -323,51 +320,51 @@ bool Item::moveToContainer(Container *container, bool checkwghtvol) {
void Item::moveToEtherealVoid() {
// It's already Ethereal
- if (flags & FLG_ETHEREAL) return;
+ if (_flags & FLG_ETHEREAL) return;
// Add it to the ethereal void
World::get_instance()->etherealPush(_objId);
- // It's owned by something removed it from the something, but keep flags
- if (flags & (FLG_CONTAINED | FLG_EQUIPPED)) {
+ // It's owned by something removed it from the something, but keep _flags
+ if (_flags & (FLG_CONTAINED | FLG_EQUIPPED)) {
- if (parent) {
+ if (_parent) {
Container *p = getParentAsContainer();
if (p) p->removeItem(this);
} else
- perr << "Item " << getObjId() << " FLG_CONTAINED or FLG_EQUIPPED set but item has no parent" << Std::endl;
- } else if (extendedflags & EXT_INCURMAP) {
+ perr << "Item " << getObjId() << " FLG_CONTAINED or FLG_EQUIPPED set but item has no _parent" << Std::endl;
+ } else if (_extendedFlags & EXT_INCURMAP) {
World::get_instance()->getCurrentMap()->removeItem(this);
}
// Set the ETHEREAL Flag
- flags |= FLG_ETHEREAL;
+ _flags |= FLG_ETHEREAL;
}
void Item::returnFromEtherealVoid() {
// It's not Ethereal
- if (!(flags & FLG_ETHEREAL)) return;
+ if (!(_flags & FLG_ETHEREAL)) return;
// Ok, we can do 2 things here
- // If an item has the contained or Equipped flags set, we return it to it's owner
- if (flags & (FLG_CONTAINED | FLG_EQUIPPED)) {
+ // If an item has the contained or Equipped _flags set, we return it to it's owner
+ if (_flags & (FLG_CONTAINED | FLG_EQUIPPED)) {
Container *p = getParentAsContainer();
if (!p) {
- perr << "Item " << getObjId() << " FLG_CONTAINED or FLG_EQUIPPED set but item has no valid parent" << Std::endl;
+ perr << "Item " << getObjId() << " FLG_CONTAINED or FLG_EQUIPPED set but item has no valid _parent" << Std::endl;
CANT_HAPPEN();
}
moveToContainer(p);
}
// or we return it to the world
else {
- move(x, y, z);
+ move(_x, _y, _z);
}
}
void Item::movedByPlayer() {
// owned-by-avatar items can't be stolen
- if (flags & FLG_OWNED) return;
+ if (_flags & FLG_OWNED) return;
// Otherwise, player is stealing.
// See if anybody is around to notice.
@@ -386,11 +383,11 @@ void Item::movedByPlayer() {
}
int32 Item::getZ() const {
- return z;
+ return _z;
}
void Item::getLocationAbsolute(int32 &X, int32 &Y, int32 &Z) const {
- if (parent) {
+ if (_parent) {
Item *p = getParentAsContainer();
if (p) {
@@ -399,50 +396,50 @@ void Item::getLocationAbsolute(int32 &X, int32 &Y, int32 &Z) const {
}
}
- X = x;
- Y = y;
- Z = z;
+ X = _x;
+ Y = _y;
+ Z = _z;
}
void Item::getGumpLocation(int32 &X, int32 &Y) const {
- if (!parent) return;
+ if (!_parent) return;
- X = y & 0xFF;
- Y = (y >> 8) & 0xFF;
+ X = _y & 0xFF;
+ Y = (_y >> 8) & 0xFF;
}
void Item::setGumpLocation(int32 X, int32 Y) {
- if (!parent) return;
+ if (!_parent) return;
- y = (X & 0xFF) + ((Y & 0xFF) << 8);
+ _y = (X & 0xFF) + ((Y & 0xFF) << 8);
}
void Item::randomGumpLocation() {
- if (!parent) return;
+ if (!_parent) return;
// This sets the coordinates to (255,255) and lets the ContainerGump
// randomize the position when it is next opened.
- y = 0xFFFF;
+ _y = 0xFFFF;
}
void Item::getCentre(int32 &X, int32 &Y, int32 &Z) const {
// constants!
ShapeInfo *shapeinfo = getShapeInfo();
- if (flags & FLG_FLIPPED) {
- X = x - shapeinfo->_y * 16;
- Y = y - shapeinfo->_x * 16;
+ if (_flags & FLG_FLIPPED) {
+ X = _x - shapeinfo->_y * 16;
+ Y = _y - shapeinfo->_x * 16;
} else {
- X = x - shapeinfo->_x * 16;
- Y = y - shapeinfo->_y * 16;
+ X = _x - shapeinfo->_x * 16;
+ Y = _y - shapeinfo->_y * 16;
}
- Z = z + shapeinfo->_z * 4;
+ Z = _z + shapeinfo->_z * 4;
}
Box Item::getWorldBox() const {
int32 xd, yd, zd;
getFootpadWorld(xd, yd, zd);
- return Box(x, y, z, xd, yd, zd);
+ return Box(_x, _y, _z, xd, yd, zd);
}
bool Item::overlaps(Item &item2) const {
@@ -568,12 +565,12 @@ int Item::getRange(Item &item2, bool checkz) const {
}
ShapeInfo *Item::getShapeInfoFromGameInstance() const {
- return GameData::get_instance()->getMainShapes()->getShapeInfo(shape);
+ return GameData::get_instance()->getMainShapes()->getShapeInfo(_shape);
}
Shape *Item::getShapeObject() const {
- if (!cachedShape) cachedShape = GameData::get_instance()->getMainShapes()->getShape(shape);
- return cachedShape;
+ if (!_cachedShape) _cachedShape = GameData::get_instance()->getMainShapes()->getShape(_shape);
+ return _cachedShape;
}
uint16 Item::getFamily() {
@@ -677,7 +674,7 @@ bool Item::checkLoopScript(const uint8 *script, uint32 scriptsize) {
stack.push2(getFlags());
break;
- case LS_TOKEN_Q: // item quality
+ case LS_TOKEN_Q: // item _quality
stack.push2(getQuality());
break;
@@ -734,7 +731,7 @@ bool Item::checkLoopScript(const uint8 *script, uint32 scriptsize) {
stack.push2(getFamily());
break;
- case LS_TOKEN_SHAPE: // item shape
+ case LS_TOKEN_SHAPE: // item _shape
stack.push2(static_cast<uint16>(getShape()));
break;
@@ -779,7 +776,7 @@ bool Item::checkLoopScript(const uint8 *script, uint32 scriptsize) {
}
break;
- case LS_TOKEN_FRAME: // item frame
+ case LS_TOKEN_FRAME: // item _frame
stack.push2(static_cast<uint16>(getFrame()));
break;
@@ -806,9 +803,9 @@ bool Item::checkLoopScript(const uint8 *script, uint32 scriptsize) {
case 'u':
case 'v':
case 'w':
- case 'x':
- case 'y':
- case 'z': {
+ case '_x':
+ case '_y':
+ case '_z': {
bool match = false;
int count = script[i] - '`';
for (int j = 0; j < count; j++) {
@@ -846,7 +843,7 @@ int32 Item::collideMove(int32 dx, int32 dy, int32 dz, bool teleport, bool force,
int32 end[3] = { dx, dy, dz };
int32 start[3];
- if (parent) {
+ if (_parent) {
// If we are moving from a container, only check the destination
start[0] = end[0];
start[1] = end[1];
@@ -877,7 +874,7 @@ int32 Item::collideMove(int32 dx, int32 dy, int32 dz, bool teleport, bool force,
int hitforce = (deltax + deltay + deltaz + maxdirdelta) / 2;
// if we are contained, we always teleport
- if (teleport || parent) {
+ if (teleport || _parent) {
// If teleporting and not force, work out if we can reach the end
if (!force) {
for (it = collisions.begin(); it != collisions.end(); it++) {
@@ -896,7 +893,7 @@ int32 Item::collideMove(int32 dx, int32 dy, int32 dz, bool teleport, bool force,
Item *item = getItem(it->_item);
// Hitting us at the start and end, don't do anything
- if (!parent && it->_hitTime == 0x0000 &&
+ if (!_parent && it->_hitTime == 0x0000 &&
it->_endTime == 0x4000) {
continue;
}
@@ -909,7 +906,7 @@ int32 Item::collideMove(int32 dx, int32 dy, int32 dz, bool teleport, bool force,
callUsecodeEvent_hit(item->getObjId(), hitforce);
}
// Hitting us at the start (call release on us and them)
- else if (!parent && it->_hitTime == 0x0000) {
+ else if (!_parent && it->_hitTime == 0x0000) {
if (_objId == 1) item->clearExtFlag(Item::EXT_HIGHLIGHT);
we_were_released = true;
item->callUsecodeEvent_release();
@@ -1012,25 +1009,25 @@ unsigned int Item::countNearby(uint32 shape_, uint16 range) {
uint32 Item::callUsecodeEvent(uint32 event, const uint8 *args, int argsize) {
- uint32 class_id = shape;
+ uint32 class_id = _shape;
- // Non-monster NPCs use _objId/npcnum + 1024
+ // Non-monster NPCs use _objId/_npcNum + 1024
// Note: in the original, a non-monster NPC is specified with
// the FAST_ONLY flag. However, this causes some summoned monster which
// do not receive the FAST_ONLY flag to behave strangely. (Confirmed that
// happens in the original as well.) -wjp 20050128
- if (_objId < 256 && (extendedflags & EXT_PERMANENT_NPC))
+ if (_objId < 256 && (_extendedFlags & EXT_PERMANENT_NPC))
class_id = _objId + 1024;
// CHECKME: to make Pentagram behave as much like the original as possible,
// don't call any usecode if the original would call the wrong class
- if (_objId < 256 && !(extendedflags & EXT_PERMANENT_NPC) &&
- !(flags & FLG_FAST_ONLY))
+ if (_objId < 256 && !(_extendedFlags & EXT_PERMANENT_NPC) &&
+ !(_flags & FLG_FAST_ONLY))
return 0;
- // UnkEggs have quality+0x47F
+ // UnkEggs have _quality+0x47F
if (getFamily() == ShapeInfo::SF_UNKEGG)
- class_id = quality + 0x47F;
+ class_id = _quality + 0x47F;
Usecode *u = GameData::get_instance()->getMainUsecode();
uint32 offset = u->get_class_event(class_id, event);
@@ -1133,7 +1130,7 @@ uint32 Item::use() {
Actor *actor = p_dynamic_cast<Actor *>(this);
if (actor) {
if (actor->isDead()) {
- // dead actor, so open/close the dead-body-gump
+ // dead actor, so open/close the dead-body-_gump
if (getFlags() & FLG_GUMP_OPEN) {
closeGump();
} else {
@@ -1147,20 +1144,20 @@ uint32 Item::use() {
}
void Item::destroy(bool delnow) {
- if (flags & FLG_ETHEREAL) {
+ if (_flags & FLG_ETHEREAL) {
// Remove us from the ether
World::get_instance()->etherealRemove(_objId);
- } else if (parent) {
- // we're in a container, so remove self from parent
+ } else if (_parent) {
+ // we're in a container, so remove self from _parent
//!! need to make sure this works for equipped items too...
Container *p = getParentAsContainer();
if (p) p->removeItem(this);
- } else if (extendedflags & EXT_INCURMAP) {
+ } else if (_extendedFlags & EXT_INCURMAP) {
// remove self from CurrentMap
- World::get_instance()->getCurrentMap()->removeItemFromList(this, x, y);
+ World::get_instance()->getCurrentMap()->removeItemFromList(this, _x, _y);
}
- if (extendedflags & Item::EXT_CAMERA)
+ if (_extendedFlags & Item::EXT_CAMERA)
CameraProcess::SetCameraProcess(0);
// Do we want to delete now or not?
@@ -1177,50 +1174,50 @@ void Item::destroy(bool delnow) {
//
// Item::setupLerp()
//
-// Desc: Setup the lerped info for this frame
+// Desc: Setup the lerped info for this _frame
//
void Item::setupLerp(int32 gametick) {
// Don't need to set us up
- if (last_setup && gametick == last_setup)
+ if (_lastSetup && gametick == _lastSetup)
return;
// Are we lerping or are we not? Default we lerp.
bool no_lerp = false;
- // No lerping this frame if Shape Changed, or No lerp is set,
+ // No lerping this _frame if Shape Changed, or No lerp is set,
// or no last setup, or last setup more than 1 tick ago
- if ((last_setup == 0) || (l_next.shape != shape) ||
- (extendedflags & EXT_LERP_NOPREV) ||
- (gametick - last_setup) > 1 || flags & FLG_CONTAINED)
+ if ((_lastSetup == 0) || (_lNext._shape != _shape) ||
+ (_extendedFlags & EXT_LERP_NOPREV) ||
+ (gametick - _lastSetup) > 1 || _flags & FLG_CONTAINED)
no_lerp = true;
// Update the time we were just setup
- last_setup = gametick;
+ _lastSetup = gametick;
// Clear the flag
- extendedflags &= ~EXT_LERP_NOPREV;
+ _extendedFlags &= ~EXT_LERP_NOPREV;
// Animate it, if needed
if ((gametick % 3) == (_objId % 3)) animateItem();
// Setup the prev values for lerping
- if (!no_lerp) l_prev = l_next;
+ if (!no_lerp) _lPrev = _lNext;
// Setup next
- if (flags & FLG_CONTAINED) {
- l_next.x = ix = y & 0xFF;
- l_next.y = iy = (y >> 8) & 0xFF;
- l_next.z = iz = 0;
+ if (_flags & FLG_CONTAINED) {
+ _lNext._x = _ix = _y & 0xFF;
+ _lNext._y = _iy = (_y >> 8) & 0xFF;
+ _lNext._z = _iz = 0;
} else {
- l_next.x = ix = x;
- l_next.y = iy = y;
- l_next.z = iz = z;
+ _lNext._x = _ix = _x;
+ _lNext._y = _iy = _y;
+ _lNext._z = _iz = _z;
}
- l_next.shape = shape;
- l_next.frame = frame;
+ _lNext._shape = _shape;
+ _lNext._frame = _frame;
// Setup prev values for not lerping
- if (no_lerp) l_prev = l_next;
+ if (no_lerp) _lPrev = _lNext;
}
// Animate the item
@@ -1233,7 +1230,7 @@ void Item::animateItem() {
int anim_data = info->_animData;
//bool dirty = false;
- if ((static_cast<int>(last_setup) % 6) != (_objId % 6) && info->_animType != 1)
+ if ((static_cast<int>(_lastSetup) % 6) != (_objId % 6) && info->_animType != 1)
return;
switch (info->_animType) {
@@ -1245,20 +1242,20 @@ void Item::animateItem() {
case 3:
// 50 % chance
if (anim_data == 1 && (getRandom() & 1)) break;
- frame ++;
+ _frame ++;
if (anim_data < 2) {
- if (shp && frame == shp->frameCount()) frame = 0;
+ if (shp && _frame == shp->frameCount()) _frame = 0;
} else {
- unsigned int num = (frame - 1) / anim_data;
- if (frame == ((num + 1)*anim_data)) frame = num * anim_data;
+ unsigned int num = (_frame - 1) / anim_data;
+ if (_frame == ((num + 1)*anim_data)) _frame = num * anim_data;
}
//dirty = true;
break;
case 4:
if (!(getRandom() % anim_data)) break;
- frame ++;
- if (shp && frame == shp->frameCount()) frame = 0;
+ _frame ++;
+ if (shp && _frame == shp->frameCount()) _frame = 0;
//dirty = true;
break;
@@ -1270,14 +1267,14 @@ void Item::animateItem() {
case 6:
if (anim_data < 2) {
- if (frame == 0) break;
- frame ++;
- if (shp && frame == shp->frameCount()) frame = 1;
+ if (_frame == 0) break;
+ _frame ++;
+ if (shp && _frame == shp->frameCount()) _frame = 1;
} else {
- if (!(frame % anim_data)) break;
- frame ++;
- unsigned int num = (frame - 1) / anim_data;
- if (frame == ((num + 1)*anim_data)) frame = num * anim_data + 1;
+ if (!(_frame % anim_data)) break;
+ _frame ++;
+ unsigned int num = (_frame - 1) / anim_data;
+ if (_frame == ((num + 1)*anim_data)) _frame = num * anim_data + 1;
}
//dirty = true;
break;
@@ -1293,10 +1290,10 @@ void Item::animateItem() {
// Called when an item has entered the fast area
void Item::enterFastArea() {
//!! HACK to get rid of endless SFX loops
- if (shape == 0x2c8) return;
+ if (_shape == 0x2c8) return;
// Call usecode
- if (!(flags & FLG_FASTAREA)) {
+ if (!(_flags & FLG_FASTAREA)) {
Actor *actor = p_dynamic_cast<Actor *>(this);
if (actor && actor->isDead()) {
@@ -1307,30 +1304,30 @@ void Item::enterFastArea() {
}
// We're fast!
- flags |= FLG_FASTAREA;
+ _flags |= FLG_FASTAREA;
}
// Called when an item is leaving the fast area
void Item::leaveFastArea() {
// Call usecode
- if ((!(flags & FLG_FAST_ONLY) || getShapeInfo()->is_noisy()) &&
- (flags & FLG_FASTAREA))
+ if ((!(_flags & FLG_FAST_ONLY) || getShapeInfo()->is_noisy()) &&
+ (_flags & FLG_FASTAREA))
callUsecodeEvent_leaveFastArea();
- // If we have a gump open, close it (unless we're in a container)
- if (!parent && (flags & FLG_GUMP_OPEN)) {
- Gump *g = Ultima8Engine::get_instance()->getGump(gump);
+ // If we have a _gump open, close it (unless we're in a container)
+ if (!_parent && (_flags & FLG_GUMP_OPEN)) {
+ Gump *g = Ultima8Engine::get_instance()->getGump(_gump);
if (g) g->Close();
}
// Unset the flag
- flags &= ~FLG_FASTAREA;
+ _flags &= ~FLG_FASTAREA;
// CHECKME: what do we need to do exactly?
// currently, destroy object
// Kill us if we are fast only, unless we're in a container
- if ((flags & FLG_FAST_ONLY) && !getParent()) {
+ if ((_flags & FLG_FAST_ONLY) && !getParent()) {
// destroy contents if container
Container *c = p_dynamic_cast<Container *>(this);
if (c) c->destroyContents();
@@ -1340,19 +1337,19 @@ void Item::leaveFastArea() {
// delete the item in this case.
}
// If we have a gravity process, move us to the ground
- else if (gravitypid) {
- Process *p = Kernel::get_instance()->getProcess(gravitypid);
+ else if (_gravityPid) {
+ Process *p = Kernel::get_instance()->getProcess(_gravityPid);
if (p) {
p->terminateDeferred();
- gravitypid = 0;
- collideMove(x, y, 0, true, false);
+ _gravityPid = 0;
+ collideMove(_x, _y, 0, true, false);
}
}
}
uint16 Item::openGump(uint32 gumpshape) {
- if (flags & FLG_GUMP_OPEN) return 0;
- assert(gump == 0);
+ if (_flags & FLG_GUMP_OPEN) return 0;
+ assert(_gump == 0);
Shape *shapeP = GameData::get_instance()->getGumps()->getShape(gumpshape);
ContainerGump *cgump;
@@ -1370,28 +1367,28 @@ uint16 Item::openGump(uint32 gumpshape) {
cgump->setItemArea(GameData::get_instance()->
getGumps()->getGumpItemArea(gumpshape));
cgump->InitGump(0);
- flags |= FLG_GUMP_OPEN;
- gump = cgump->getObjId();
+ _flags |= FLG_GUMP_OPEN;
+ _gump = cgump->getObjId();
- return gump;
+ return _gump;
}
void Item::closeGump() {
- if (!(flags & FLG_GUMP_OPEN)) return;
+ if (!(_flags & FLG_GUMP_OPEN)) return;
- Gump *g = Ultima8Engine::get_instance()->getGump(gump);
+ Gump *g = Ultima8Engine::get_instance()->getGump(_gump);
assert(g);
g->Close();
- // can we already clear gump here, or do we need to wait for the gump
+ // can we already clear _gump here, or do we need to wait for the _gump
// to really close??
clearGump();
}
void Item::clearGump() {
- gump = 0;
- flags &= ~FLG_GUMP_OPEN;
+ _gump = 0;
+ _flags &= ~FLG_GUMP_OPEN;
}
int32 Item::ascend(int delta) {
@@ -1432,14 +1429,14 @@ int32 Item::ascend(int delta) {
if (!item) continue;
if (item->getShapeInfo()->is_fixed()) continue;
- item->getLocation(ix, iy, iz);
+ item->getLocation(_ix, _iy, _iz);
- if (item->canExistAt(ix, iy, iz + delta)) {
- item->move(ix, iy, iz + delta); // automatically un-etherealizes item
+ if (item->canExistAt(_ix, _iy, _iz + delta)) {
+ item->move(_ix, _iy, _iz + delta); // automatically un-etherealizes item
} else {
// uh oh...
// CHECKME: what do we do here?
- item->move(ix, iy, iz);
+ item->move(_ix, _iy, _iz);
if (delta < 0) item->fall();
}
}
@@ -1449,9 +1446,9 @@ int32 Item::ascend(int delta) {
GravityProcess *Item::ensureGravityProcess() {
GravityProcess *p = 0;
- if (gravitypid) {
+ if (_gravityPid) {
p = p_dynamic_cast<GravityProcess *>(
- Kernel::get_instance()->getProcess(gravitypid));
+ Kernel::get_instance()->getProcess(_gravityPid));
} else {
p = new GravityProcess(this, 0);
Kernel::get_instance()->addProcess(p);
@@ -1462,7 +1459,7 @@ GravityProcess *Item::ensureGravityProcess() {
}
void Item::fall() {
- if (flags & FLG_HANGING || getShapeInfo()->is_fixed()) {
+ if (_flags & FLG_HANGING || getShapeInfo()->is_fixed()) {
// can't fall
return;
}
@@ -1509,7 +1506,7 @@ void Item::hurl(int xs, int ys, int zs, int grav) {
void Item::explode() {
Process *p = new SpriteProcess(578, 20, 34, 1, 1, //!! constants
- x, y, z);
+ _x, _y, _z);
Kernel::get_instance()->addProcess(p);
int sfx = (getRandom() % 2) ? 31 : 158;
@@ -1731,13 +1728,13 @@ bool Item::canMergeWith(Item *other) {
uint32 frame2 = other->getFrame();
if (frame1 == frame2) return true;
- // special cases: necromancy reagents, shape 395
- // blood: frame 0-5
- // bone: frame 6-7
- // wood: frame 8
- // dirt: frame 9
- // ex.hood: frame 10-12
- // blackmoor: frame 14-15
+ // special cases: necromancy reagents, _shape 395
+ // blood: _frame 0-5
+ // bone: _frame 6-7
+ // wood: _frame 8
+ // dirt: _frame 9
+ // ex.hood: _frame 10-12
+ // blackmoor: _frame 14-15
if (CoreApp::get_instance()->getGameInfo()->_type == GameInfo::GAME_U8) {
if (getShape() != 395) return false;
@@ -1756,53 +1753,53 @@ bool Item::canMergeWith(Item *other) {
void Item::saveData(ODataSource *ods) {
Object::saveData(ods);
- ods->write2(static_cast<uint16>(extendedflags));
- ods->write2(flags);
- ods->write2(static_cast<uint16>(shape));
- ods->write2(static_cast<uint16>(frame));
- ods->write2(static_cast<uint16>(x));
- ods->write2(static_cast<uint16>(y));
- ods->write2(static_cast<uint16>(z));
- ods->write2(quality);
- ods->write2(npcnum);
- ods->write2(mapnum);
+ ods->write2(static_cast<uint16>(_extendedFlags));
+ ods->write2(_flags);
+ ods->write2(static_cast<uint16>(_shape));
+ ods->write2(static_cast<uint16>(_frame));
+ ods->write2(static_cast<uint16>(_x));
+ ods->write2(static_cast<uint16>(_y));
+ ods->write2(static_cast<uint16>(_z));
+ ods->write2(_quality);
+ ods->write2(_npcNum);
+ ods->write2(_mapNum);
if (getObjId() != 0xFFFF) {
// these only make sense in currently loaded items
- ods->write2(gump);
- ods->write2(gravitypid);
+ ods->write2(_gump);
+ ods->write2(_gravityPid);
}
- if ((flags & FLG_ETHEREAL) && (flags & (FLG_CONTAINED | FLG_EQUIPPED)))
- ods->write2(parent);
+ if ((_flags & FLG_ETHEREAL) && (_flags & (FLG_CONTAINED | FLG_EQUIPPED)))
+ ods->write2(_parent);
}
bool Item::loadData(IDataSource *ids, uint32 version) {
if (!Object::loadData(ids, version)) return false;
- extendedflags = ids->read2();
- flags = ids->read2();
- shape = ids->read2();
- frame = ids->read2();
- x = ids->read2();
- y = ids->read2();
- z = ids->read2();
-
- quality = ids->read2();
- npcnum = ids->read2();
- mapnum = ids->read2();
+ _extendedFlags = ids->read2();
+ _flags = ids->read2();
+ _shape = ids->read2();
+ _frame = ids->read2();
+ _x = ids->read2();
+ _y = ids->read2();
+ _z = ids->read2();
+
+ _quality = ids->read2();
+ _npcNum = ids->read2();
+ _mapNum = ids->read2();
if (getObjId() != 0xFFFF) {
- gump = ids->read2();
- gravitypid = ids->read2();
+ _gump = ids->read2();
+ _gravityPid = ids->read2();
} else {
- gump = gravitypid = 0;
+ _gump = _gravityPid = 0;
}
- if ((flags & FLG_ETHEREAL) && (flags & (FLG_CONTAINED | FLG_EQUIPPED)))
- parent = ids->read2();
+ if ((_flags & FLG_ETHEREAL) && (_flags & (FLG_CONTAINED | FLG_EQUIPPED)))
+ _parent = ids->read2();
else
- parent = 0;
+ _parent = 0;
//!! hackish...
- if (extendedflags & EXT_INCURMAP) {
+ if (_extendedFlags & EXT_INCURMAP) {
World::get_instance()->getCurrentMap()->addItem(this);
}
@@ -1823,63 +1820,63 @@ uint32 Item::I_getX(const uint8 *args, unsigned int /*argsize*/) {
ARG_ITEM_FROM_PTR(item);
if (!item) return 0;
- int32 x, y, z;
- item->getLocationAbsolute(x, y, z);
- return x;
+ int32 _x, _y, _z;
+ item->getLocationAbsolute(_x, _y, _z);
+ return _x;
}
uint32 Item::I_getY(const uint8 *args, unsigned int /*argsize*/) {
ARG_ITEM_FROM_PTR(item);
if (!item) return 0;
- int32 x, y, z;
- item->getLocationAbsolute(x, y, z);
- return y;
+ int32 _x, _y, _z;
+ item->getLocationAbsolute(_x, _y, _z);
+ return _y;
}
uint32 Item::I_getZ(const uint8 *args, unsigned int /*argsize*/) {
ARG_ITEM_FROM_PTR(item);
if (!item) return 0;
- int32 x, y, z;
- item->getLocationAbsolute(x, y, z);
- return z;
+ int32 _x, _y, _z;
+ item->getLocationAbsolute(_x, _y, _z);
+ return _z;
}
uint32 Item::I_getCX(const uint8 *args, unsigned int /*argsize*/) {
ARG_ITEM_FROM_PTR(item);
if (!item) return 0;
- int32 x, y, z;
- item->getLocationAbsolute(x, y, z);
+ int32 _x, _y, _z;
+ item->getLocationAbsolute(_x, _y, _z);
- if (item->flags & FLG_FLIPPED)
- return x - item->getShapeInfo()->_y * 16;
+ if (item->_flags & FLG_FLIPPED)
+ return _x - item->getShapeInfo()->_y * 16;
else
- return x - item->getShapeInfo()->_x * 16;
+ return _x - item->getShapeInfo()->_x * 16;
}
uint32 Item::I_getCY(const uint8 *args, unsigned int /*argsize*/) {
ARG_ITEM_FROM_PTR(item);
if (!item) return 0;
- int32 x, y, z;
- item->getLocationAbsolute(x, y, z);
+ int32 _x, _y, _z;
+ item->getLocationAbsolute(_x, _y, _z);
- if (item->flags & FLG_FLIPPED)
- return y - item->getShapeInfo()->_x * 16;
+ if (item->_flags & FLG_FLIPPED)
+ return _y - item->getShapeInfo()->_x * 16;
else
- return y - item->getShapeInfo()->_y * 16;
+ return _y - item->getShapeInfo()->_y * 16;
}
uint32 Item::I_getCZ(const uint8 *args, unsigned int /*argsize*/) {
ARG_ITEM_FROM_PTR(item);
if (!item) return 0;
- int32 x, y, z;
- item->getLocationAbsolute(x, y, z);
+ int32 _x, _y, _z;
+ item->getLocationAbsolute(_x, _y, _z);
- return z + item->getShapeInfo()->_z * 4;
+ return _z + item->getShapeInfo()->_z * 4;
}
uint32 Item::I_getPoint(const uint8 *args, unsigned int /*argsize*/) {
@@ -1887,13 +1884,13 @@ uint32 Item::I_getPoint(const uint8 *args, unsigned int /*argsize*/) {
ARG_UC_PTR(ptr);
if (!item) return 0;
- int32 x, y, z;
- item->getLocationAbsolute(x, y, z);
+ int32 _x, _y, _z;
+ item->getLocationAbsolute(_x, _y, _z);
WorldPoint point;
- point.setX(x);
- point.setY(y);
- point.setZ(z);
+ point.setX(_x);
+ point.setY(_y);
+ point.setZ(_z);
UCMachine::get_instance()->assignPointer(ptr, point.buf, 5);
@@ -1909,10 +1906,10 @@ uint32 Item::I_getShape(const uint8 *args, unsigned int /*argsize*/) {
uint32 Item::I_setShape(const uint8 *args, unsigned int /*argsize*/) {
ARG_ITEM_FROM_PTR(item);
- ARG_UINT16(shape);
+ ARG_UINT16(_shape);
if (!item) return 0;
- item->setShape(shape);
+ item->setShape(_shape);
return 0;
}
@@ -1925,10 +1922,10 @@ uint32 Item::I_getFrame(const uint8 *args, unsigned int /*argsize*/) {
uint32 Item::I_setFrame(const uint8 *args, unsigned int /*argsize*/) {
ARG_ITEM_FROM_PTR(item);
- ARG_UINT16(frame);
+ ARG_UINT16(_frame);
if (!item) return 0;
- item->setFrame(frame);
+ item->setFrame(_frame);
return 0;
}
@@ -1972,7 +1969,7 @@ uint32 Item::I_getContainer(const uint8 *args, unsigned int /*argsize*/) {
ARG_ITEM_FROM_PTR(item);
if (!item) return 0;
- //! What do we do if item has no parent?
+ //! What do we do if item has no _parent?
//! What do we do with equipped items?
if (item->getParent())
@@ -1985,18 +1982,18 @@ uint32 Item::I_getRootContainer(const uint8 *args, unsigned int /*argsize*/) {
ARG_ITEM_FROM_PTR(item);
if (!item) return 0;
- Container *parent = item->getParentAsContainer();
+ Container *_parent = item->getParentAsContainer();
- //! What do we do if item has no parent?
+ //! What do we do if item has no _parent?
//! What do we do with equipped items?
- if (!parent) return 0;
+ if (!_parent) return 0;
- while (parent->getParentAsContainer()) {
- parent = parent->getParentAsContainer();
+ while (_parent->getParentAsContainer()) {
+ _parent = _parent->getParentAsContainer();
}
- return parent->getObjId();
+ return _parent->getObjId();
}
uint32 Item::I_getQ(const uint8 *args, unsigned int /*argsize*/) {
@@ -2111,7 +2108,7 @@ uint32 Item::I_orStatus(const uint8 *args, unsigned int /*argsize*/) {
ARG_UINT16(mask);
if (!item) return 0;
- item->flags |= mask;
+ item->_flags |= mask;
return 0;
}
@@ -2120,7 +2117,7 @@ uint32 Item::I_andStatus(const uint8 *args, unsigned int /*argsize*/) {
ARG_UINT16(mask);
if (!item) return 0;
- item->flags &= mask;
+ item->_flags &= mask;
return 0;
}
@@ -2160,18 +2157,18 @@ uint32 Item::I_bark(const uint8 *args, unsigned int /*argsize*/) {
uint32 shapenum = item->getShape();
if (id_item == 666) shapenum = 666; // Hack for guardian barks
- Gump *gump = new BarkGump(item->getObjId(), str, shapenum);
+ Gump *_gump = new BarkGump(item->getObjId(), str, shapenum);
if (item->getObjId() < 256) { // CONSTANT!
GumpNotifyProcess *notifyproc;
notifyproc = new ActorBarkNotifyProcess(item->getObjId());
Kernel::get_instance()->addProcess(notifyproc);
- gump->SetNotifyProcess(notifyproc);
+ _gump->SetNotifyProcess(notifyproc);
}
- gump->InitGump(0);
+ _gump->InitGump(0);
- return gump->GetNotifyProcess()->getPid();
+ return _gump->GetNotifyProcess()->getPid();
}
uint32 Item::I_look(const uint8 *args, unsigned int /*argsize*/) {
@@ -2212,28 +2209,28 @@ uint32 Item::I_ask(const uint8 *args, unsigned int /*argsize*/) {
if (!answers) return 0;
// Use AskGump
- Gump *gump = new AskGump(1, answers);
- gump->InitGump(0);
- return gump->GetNotifyProcess()->getPid();
+ Gump *_gump = new AskGump(1, answers);
+ _gump->InitGump(0);
+ return _gump->GetNotifyProcess()->getPid();
}
uint32 Item::I_legalCreateAtPoint(const uint8 *args, unsigned int /*argsize*/) {
ARG_UC_PTR(itemptr); // need to store the item id at *itemptr
- ARG_UINT16(shape);
- ARG_UINT16(frame);
+ ARG_UINT16(_shape);
+ ARG_UINT16(_frame);
ARG_WORLDPOINT(point);
// check if item can exist
CurrentMap *cm = World::get_instance()->getCurrentMap();
bool valid = cm->isValidPosition(point.getX(), point.getY(), point.getZ(),
- shape, 0, 0, 0);
+ _shape, 0, 0, 0);
if (!valid)
return 0;
- Item *newitem = ItemFactory::createItem(shape, frame, 0, 0, 0, 0, 0, true);
+ Item *newitem = ItemFactory::createItem(_shape, _frame, 0, 0, 0, 0, 0, true);
if (!newitem) {
- perr << "I_legalCreateAtPoint failed to create item (" << shape
- << "," << frame << ")." << Std::endl;
+ perr << "I_legalCreateAtPoint failed to create item (" << _shape
+ << "," << _frame << ")." << Std::endl;
return 0;
}
uint16 objID = newitem->getObjId();
@@ -2249,27 +2246,27 @@ uint32 Item::I_legalCreateAtPoint(const uint8 *args, unsigned int /*argsize*/) {
uint32 Item::I_legalCreateAtCoords(const uint8 *args, unsigned int /*argsize*/) {
ARG_UC_PTR(itemptr); // need to store the item id at *itemptr
- ARG_UINT16(shape);
- ARG_UINT16(frame);
- ARG_UINT16(x);
- ARG_UINT16(y);
- ARG_UINT16(z);
+ ARG_UINT16(_shape);
+ ARG_UINT16(_frame);
+ ARG_UINT16(_x);
+ ARG_UINT16(_y);
+ ARG_UINT16(_z);
// check if item can exist
CurrentMap *cm = World::get_instance()->getCurrentMap();
- bool valid = cm->isValidPosition(x, y, z, shape, 0, 0, 0);
+ bool valid = cm->isValidPosition(_x, _y, _z, _shape, 0, 0, 0);
if (!valid)
return 0;
// if yes, create it
- Item *newitem = ItemFactory::createItem(shape, frame, 0, 0, 0, 0, 0, true);
+ Item *newitem = ItemFactory::createItem(_shape, _frame, 0, 0, 0, 0, 0, true);
if (!newitem) {
- perr << "I_legalCreateAtCoords failed to create item (" << shape
- << "," << frame << ")." << Std::endl;
+ perr << "I_legalCreateAtCoords failed to create item (" << _shape
+ << "," << _frame << ")." << Std::endl;
return 0;
}
uint16 objID = newitem->getObjId();
- newitem->move(x, y, z);
+ newitem->move(_x, _y, _z);
uint8 buf[2];
buf[0] = static_cast<uint8>(objID);
@@ -2281,8 +2278,8 @@ uint32 Item::I_legalCreateAtCoords(const uint8 *args, unsigned int /*argsize*/)
uint32 Item::I_legalCreateInCont(const uint8 *args, unsigned int /*argsize*/) {
ARG_UC_PTR(itemptr); // need to store the item id at *itemptr
- ARG_UINT16(shape);
- ARG_UINT16(frame);
+ ARG_UINT16(_shape);
+ ARG_UINT16(_frame);
ARG_CONTAINER_FROM_ID(container);
ARG_UINT16(unknown); // ?
@@ -2294,10 +2291,10 @@ uint32 Item::I_legalCreateInCont(const uint8 *args, unsigned int /*argsize*/) {
// Create an item and try to add it to the given container.
// If it fits, return id; otherwise return 0.
- Item *newitem = ItemFactory::createItem(shape, frame, 0, 0, 0, 0, 0, true);
+ Item *newitem = ItemFactory::createItem(_shape, _frame, 0, 0, 0, 0, 0, true);
if (!newitem) {
- perr << "I_legalCreateInCont failed to create item (" << shape
- << "," << frame << ")." << Std::endl;
+ perr << "I_legalCreateInCont failed to create item (" << _shape
+ << "," << _frame << ")." << Std::endl;
return 0;
}
@@ -2337,19 +2334,19 @@ uint32 Item::I_getFootpadData(const uint8 *args, unsigned int /*argsize*/) {
if (!item) return 0;
uint8 buf[2];
- int32 x, y, z;
- item->getFootpadData(x, y, z);
+ int32 _x, _y, _z;
+ item->getFootpadData(_x, _y, _z);
- buf[0] = static_cast<uint8>(x);
- buf[1] = static_cast<uint8>(x >> 8);
+ buf[0] = static_cast<uint8>(_x);
+ buf[1] = static_cast<uint8>(_x >> 8);
UCMachine::get_instance()->assignPointer(xptr, buf, 2);
- buf[0] = static_cast<uint8>(y);
- buf[1] = static_cast<uint8>(y >> 8);
+ buf[0] = static_cast<uint8>(_y);
+ buf[1] = static_cast<uint8>(_y >> 8);
UCMachine::get_instance()->assignPointer(yptr, buf, 2);
- buf[0] = static_cast<uint8>(z);
- buf[1] = static_cast<uint8>(z >> 8);
+ buf[0] = static_cast<uint8>(_z);
+ buf[1] = static_cast<uint8>(_z >> 8);
UCMachine::get_instance()->assignPointer(zptr, buf, 2);
return 0;
@@ -2392,10 +2389,10 @@ uint32 Item::I_isOn(const uint8 *args, unsigned int /*argsize*/) {
}
uint32 Item::I_getFamilyOfType(const uint8 *args, unsigned int /*argsize*/) {
- ARG_UINT16(shape);
+ ARG_UINT16(_shape);
return GameData::get_instance()->getMainShapes()->
- getShapeInfo(shape)->_family;
+ getShapeInfo(_shape)->_family;
}
uint32 Item::I_push(const uint8 *args, unsigned int /*argsize*/) {
@@ -2409,20 +2406,20 @@ uint32 Item::I_push(const uint8 *args, unsigned int /*argsize*/) {
uint32 Item::I_create(const uint8 *args, unsigned int /*argsize*/) {
ARG_UC_PTR(itemptr); // need to store the item id at *itemptr (????)
- ARG_UINT16(shape);
- ARG_UINT16(frame);
+ ARG_UINT16(_shape);
+ ARG_UINT16(_frame);
- Item *newitem = ItemFactory::createItem(shape, frame, 0, 0, 0, 0, 0, true);
+ Item *newitem = ItemFactory::createItem(_shape, _frame, 0, 0, 0, 0, 0, true);
if (!newitem) {
- perr << "I_create failed to create item (" << shape
- << "," << frame << ")." << Std::endl;
+ perr << "I_create failed to create item (" << _shape
+ << "," << _frame << ")." << Std::endl;
return 0;
}
uint16 objID = newitem->getObjId();
#if 0
- pout << "Item::create: created item " << objID << " (" << shape
- << "," << frame << ")" << Std::endl;
+ pout << "Item::create: created item " << objID << " (" << _shape
+ << "," << _frame << ")" << Std::endl;
#endif
newitem->moveToEtherealVoid();
@@ -2462,9 +2459,9 @@ uint32 Item::I_pop(const uint8 *args, unsigned int /*argsize*/) {
uint32 Item::I_popToCoords(const uint8 *args, unsigned int /*argsize*/) {
ARG_NULL32(); // ARG_ITEM_FROM_PTR(item); // unused
- ARG_UINT16(x);
- ARG_UINT16(y);
- ARG_UINT16(z);
+ ARG_UINT16(_x);
+ ARG_UINT16(_y);
+ ARG_UINT16(_z);
World *w = World::get_instance();
@@ -2477,10 +2474,10 @@ uint32 Item::I_popToCoords(const uint8 *args, unsigned int /*argsize*/) {
return 0; // top item was invalid
}
- item->move(x, y, z);
+ item->move(_x, _y, _z);
#if 0
- perr << "Popping item into map: " << item->getShape() << "," << item->getFrame() << " at (" << x << "," << y << "," << z << ")" << Std::endl;
+ perr << "Popping item into map: " << item->getShape() << "," << item->getFrame() << " at (" << _x << "," << _y << "," << _z << ")" << Std::endl;
#endif
//! Anything else?
@@ -2547,15 +2544,15 @@ uint32 Item::I_popToEnd(const uint8 *args, unsigned int /*argsize*/) {
uint32 Item::I_move(const uint8 *args, unsigned int /*argsize*/) {
ARG_ITEM_FROM_PTR(item);
- ARG_UINT16(x);
- ARG_UINT16(y);
- ARG_UINT16(z);
+ ARG_UINT16(_x);
+ ARG_UINT16(_y);
+ ARG_UINT16(_z);
if (!item) return 0;
//! What should this do to ethereal items?
- item->move(x, y, z);
- //item->collideMove(x, y, z, true, true);
+ item->move(_x, _y, _z);
+ //item->collideMove(_x, _y, _z, true, true);
return 0;
}
@@ -2602,10 +2599,10 @@ uint32 Item::I_getMapArray(const uint8 *args, unsigned int /*argsize*/) {
//!!! is this correct?
uint32 Item::I_setMapArray(const uint8 *args, unsigned int /*argsize*/) {
ARG_ITEM_FROM_PTR(item);
- ARG_UINT16(mapnum);
+ ARG_UINT16(_mapNum);
if (!item) return 0;
- item->setMapNum(mapnum);
+ item->setMapNum(_mapNum);
return 0;
}
@@ -2618,26 +2615,26 @@ uint32 Item::I_getNpcNum(const uint8 *args, unsigned int /*argsize*/) {
uint32 Item::I_getDirToCoords(const uint8 *args, unsigned int /*argsize*/) {
ARG_ITEM_FROM_PTR(item);
- ARG_UINT16(x);
- ARG_UINT16(y);
+ ARG_UINT16(_x);
+ ARG_UINT16(_y);
if (!item) return 0;
int32 ix, iy, iz;
item->getLocationAbsolute(ix, iy, iz);
- return Get_WorldDirection(y - iy, x - ix);
+ return Get_WorldDirection(_y - iy, _x - ix);
}
uint32 Item::I_getDirFromCoords(const uint8 *args, unsigned int /*argsize*/) {
ARG_ITEM_FROM_PTR(item);
- ARG_UINT16(x);
- ARG_UINT16(y);
+ ARG_UINT16(_x);
+ ARG_UINT16(_y);
if (!item) return 0;
int32 ix, iy, iz;
item->getLocationAbsolute(ix, iy, iz);
- return Get_WorldDirection(iy - y, ix - x);
+ return Get_WorldDirection(iy - _y, ix - _x);
}
uint32 Item::I_getDirToItem(const uint8 *args, unsigned int /*argsize*/) {
@@ -2680,7 +2677,7 @@ uint32 Item::I_hurl(const uint8 *args, unsigned int /*argsize*/) {
item->hurl(xs, ys, zs, grav);
- return item->gravitypid;
+ return item->_gravityPid;
}
uint32 Item::I_shoot(const uint8 *args, unsigned int /*argsize*/) {
@@ -2726,9 +2723,9 @@ uint32 Item::I_getSliderInput(const uint8 *args, unsigned int /*argsize*/) {
// pout << "SliderGump: min=" << minval << ", max=" << maxval << ", step=" << step << Std::endl;
- SliderGump *gump = new SliderGump(100, 100, minval, maxval, minval, step);
- gump->InitGump(0); // modal gump
- gump->setUsecodeNotify(current);
+ SliderGump *_gump = new SliderGump(100, 100, minval, maxval, minval, step);
+ _gump->InitGump(0); // modal _gump
+ _gump->setUsecodeNotify(current);
current->suspend();
@@ -2808,15 +2805,15 @@ uint32 Item::I_explode(const uint8 *args, unsigned int /*argsize*/) {
}
uint32 Item::I_igniteChaos(const uint8 *args, unsigned int /*argsize*/) {
- ARG_UINT16(x);
- ARG_UINT16(y);
+ ARG_UINT16(_x);
+ ARG_UINT16(_y);
ARG_NULL8();
UCList itemlist(2);
LOOPSCRIPT(script, LS_SHAPE_EQUAL(592)); // all oilflasks (CONSTANT!)
CurrentMap *currentmap = World::get_instance()->getCurrentMap();
currentmap->areaSearch(&itemlist, script, sizeof(script), 0,
- 160, false, x, y); //! CHECKME: 160?
+ 160, false, _x, _y); //! CHECKME: 160?
for (unsigned int i = 0; i < itemlist.getSize(); ++i) {
Item *item = getItem(itemlist.getuint16(i));
diff --git a/engines/ultima/ultima8/world/item.h b/engines/ultima/ultima8/world/item.h
index 7ffed3b..03448e5 100644
--- a/engines/ultima/ultima8/world/item.h
+++ b/engines/ultima/ultima8/world/item.h
@@ -51,12 +51,12 @@ public:
//! Get the Container this Item is in, if any. (0 if not in a Container)
ObjId getParent() const {
- return parent;
+ return _parent;
}
//! Set the parent container of this item.
void setParent(ObjId p) {
- parent = p;
+ _parent = p;
}
//! Get the Container this Item is in, if any. (NULL if not in a Container)
@@ -101,8 +101,8 @@ public:
int32 getZ() const;
//! Set this Item's Z coordinate
- void setZ(int32 z_) {
- z = z_;
+ void setZ(int32 z) {
+ _z = z;
}
//! Get this Item's location in a ContainerGump. Undefined if the Item
@@ -134,12 +134,12 @@ public:
//! Get flags
inline uint16 getFlags() const {
- return flags;
+ return _flags;
}
//! Set the flags set in the given mask.
void setFlag(uint32 mask) {
- flags |= mask;
+ _flags |= mask;
}
virtual void setFlagRecursively(uint32 mask) {
@@ -148,83 +148,83 @@ public:
//! Clear the flags set in the given mask.
void clearFlag(uint32 mask) {
- flags &= ~mask;
+ _flags &= ~mask;
}
- //! Set extendedflags
+ //! Set _extendedFlags
void setExtFlags(uint32 f) {
- extendedflags = f;
+ _extendedFlags = f;
}
- //! Get extendedflags
+ //! Get _extendedFlags
inline uint32 getExtFlags() const {
- return extendedflags;
+ return _extendedFlags;
}
- //! Set the extendedflags set in the given mask.
+ //! Set the _extendedFlags set in the given mask.
void setExtFlag(uint32 mask) {
- extendedflags |= mask;
+ _extendedFlags |= mask;
}
- //! Clear the extendedflags set in the given mask.
+ //! Clear the _extendedFlags set in the given mask.
void clearExtFlag(uint32 mask) {
- extendedflags &= ~mask;
+ _extendedFlags &= ~mask;
}
//! Get this Item's shape number
uint32 getShape() const {
- return shape;
+ return _shape;
}
//! Set this Item's shape number
void setShape(uint32 shape_) {
- shape = shape_;
- cachedShapeInfo = 0;
- cachedShape = 0;
+ _shape = shape_;
+ _cachedShapeInfo = 0;
+ _cachedShape = 0;
}
//! Get this Item's frame number
uint32 getFrame() const {
- return frame;
+ return _frame;
}
//! Set this Item's frame number
void setFrame(uint32 frame_) {
- frame = frame_;
+ _frame = frame_;
}
//! Get this Item's quality (a.k.a. 'Q')
uint16 getQuality() const {
- return quality;
+ return _quality;
}
//! Set this Item's quality (a.k.a 'Q');
void setQuality(uint16 quality_) {
- quality = quality_;
+ _quality = quality_;
}
//! Get the 'NpcNum' of this Item. Note that this can represent various
//! things depending on the family of this Item.
uint16 getNpcNum() const {
- return npcnum;
+ return _npcNum;
}
//! Set the 'NpcNum' of this Item. Note that this can represent various
//! things depending on the family of this Item.
void setNpcNum(uint16 npcnum_) {
- npcnum = npcnum_;
+ _npcNum = npcnum_;
}
//! Get the 'MapNum' of this Item. Note that this can represent various
//! things depending on the family of this Item.
uint16 getMapNum() const {
- return mapnum;
+ return _mapNum;
}
//! Set the 'NpcNum' of this Item. Note that this can represent various
//! things depending on the family of this Item.
void setMapNum(uint16 mapnum_) {
- mapnum = mapnum_;
+ _mapNum = mapnum_;
}
//! Get the ShapeInfo object for this Item. (The pointer will be cached.)
@@ -244,8 +244,8 @@ public:
bool canMergeWith(Item *other);
//! Get the open ContainerGump for this Item, if any. (NULL if not open.)
- ObjId getGump() {
- return gump;
+ ObjId getGump() const {
+ return _gump;
}
//! Call this to notify the Item's open Gump has closed.
void clearGump(); // set gump to 0 and clear the GUMP_OPEN flag
@@ -325,12 +325,12 @@ public:
//! Set the PID of the GravityProcess for this Item
void setGravityPID(ProcId pid) {
- gravitypid = pid;
+ _gravityPid = pid;
}
//! Get the PID of the GravityProcess for this Item (or 0)
ProcId getGravityPID() const {
- return gravitypid;
+ return _gravityPid;
}
//! Get the GravityProcess of this Item, creating it if necessary
@@ -395,9 +395,9 @@ public:
//! Get lerped location.
inline void getLerped(int32 &xp, int32 &yp, int32 &zp) const {
- xp = ix;
- yp = iy;
- zp = iz;
+ xp = _ix;
+ yp = _iy;
+ zp = _iz;
}
//! Do lerping for an in between frame (0-256)
@@ -408,23 +408,23 @@ public:
// not that it matters because on disk they are unsigned 16 bit
if (factor == 256) {
- ix = l_next.x;
- iy = l_next.y;
- iz = l_next.z;
+ _ix = _lNext._x;
+ _iy = _lNext._y;
+ _iz = _lNext._z;
} else if (factor == 0) {
- ix = l_prev.x;
- iy = l_prev.y;
- iz = l_prev.z;
+ _ix = _lPrev._x;
+ _iy = _lPrev._y;
+ _iz = _lPrev._z;
} else {
#if 1
// This way while possibly slower is more accurate
- ix = ((l_prev.x * (256 - factor) + l_next.x * factor) >> 8);
- iy = ((l_prev.y * (256 - factor) + l_next.y * factor) >> 8);
- iz = ((l_prev.z * (256 - factor) + l_next.z * factor) >> 8);
+ _ix = ((_lPrev._x * (256 - factor) + _lNext._x * factor) >> 8);
+ _iy = ((_lPrev._y * (256 - factor) + _lNext._y * factor) >> 8);
+ _iz = ((_lPrev._z * (256 - factor) + _lNext._z * factor) >> 8);
#else
- ix = l_prev.x + (((l_next.x - l_prev.x) * factor) >> 8);
- iy = l_prev.y + (((l_next.y - l_prev.y) * factor) >> 8);
- iz = l_prev.z + (((l_next.z - l_prev.z) * factor) >> 8);
+ _ix = _lPrev.x + (((_lNext.x - _lPrev.x) * factor) >> 8);
+ _iy = _lPrev.y + (((_lNext.y - _lPrev.y) * factor) >> 8);
+ _iz = _lPrev.z + (((_lNext.z - _lPrev.z) * factor) >> 8);
#endif
}
}
@@ -529,36 +529,36 @@ public:
INTRINSIC(I_isCrusTypeNPC);
private:
- uint32 shape; // DO NOT modify this directly! Always use setShape()!
+ uint32 _shape; // DO NOT modify this directly! Always use setShape()!
protected:
- uint32 frame;
+ uint32 _frame;
- int32 x, y, z; // world coordinates
- uint16 flags;
- uint16 quality;
- uint16 npcnum;
- uint16 mapnum;
+ int32 _x, _y, _z; // world coordinates
+ uint16 _flags;
+ uint16 _quality;
+ uint16 _npcNum;
+ uint16 _mapNum;
- uint32 extendedflags; // pentagram's own flags
+ uint32 _extendedFlags; // pentagram's own flags
- ObjId parent; // objid container this item is in (or 0 for top-level items)
+ ObjId _parent; // objid container this item is in (or 0 for top-level items)
- mutable Shape *cachedShape;
- mutable ShapeInfo *cachedShapeInfo;
+ mutable Shape *_cachedShape;
+ mutable ShapeInfo *_cachedShapeInfo;
// This is stuff that is used for displaying and interpolation
struct Lerped {
- int32 x, y, z;
- uint32 shape, frame;
+ int32 _x, _y, _z;
+ uint32 _shape, _frame;
};
- Lerped l_prev; // Previous state (relative to camera)
- Lerped l_next; // Next (current) state (relative to camera)
- int32 ix, iy, iz; // Interpolated position in camera space
+ Lerped _lPrev; // Previous state (relative to camera)
+ Lerped _lNext; // Next (current) state (relative to camera)
+ int32 _ix, _iy, _iz; // Interpolated position in camera space
- ObjId gump; // Item's gump
- ProcId gravitypid; // Item's GravityTracker (or 0)
+ ObjId _gump; // Item's gump
+ ProcId _gravityPid; // Item's GravityTracker (or 0)
//! save the actual Item data
void saveData(ODataSource *ods) override;
@@ -569,7 +569,7 @@ private:
uint32 callUsecodeEvent(uint32 event, const uint8 *args = 0, int argsize = 0);
//! The gametick setupLerp was last called on
- int32 last_setup;
+ int32 _lastSetup;
//! Animate the item (called by setupLerp)
void animateItem();
@@ -605,16 +605,16 @@ public:
};
inline ShapeInfo *Item::getShapeInfo() const {
- if (!cachedShapeInfo)
- cachedShapeInfo = getShapeInfoFromGameInstance();
- return cachedShapeInfo;
+ if (!_cachedShapeInfo)
+ _cachedShapeInfo = getShapeInfoFromGameInstance();
+ return _cachedShapeInfo;
}
inline void Item::getFootpadData(int32 &X, int32 &Y, int32 &Z) const {
ShapeInfo *si = getShapeInfo();
Z = si->_z;
- if (flags & Item::FLG_FLIPPED) {
+ if (_flags & Item::FLG_FLIPPED) {
X = si->_y;
Y = si->_x;
} else {
@@ -628,7 +628,7 @@ inline void Item::getFootpadWorld(int32 &X, int32 &Y, int32 &Z) const {
ShapeInfo *si = getShapeInfo();
Z = si->_z * 8;
- if (flags & Item::FLG_FLIPPED) {
+ if (_flags & Item::FLG_FLIPPED) {
X = si->_y * 32;
Y = si->_x * 32;
} else {
@@ -638,9 +638,9 @@ inline void Item::getFootpadWorld(int32 &X, int32 &Y, int32 &Z) const {
}
inline void Item::getLocation(int32 &X, int32 &Y, int32 &Z) const {
- X = x;
- Y = y;
- Z = z;
+ X = _x;
+ Y = _y;
+ Z = _z;
}
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/item_factory.cpp b/engines/ultima/ultima8/world/item_factory.cpp
index c419cad..838f183 100644
--- a/engines/ultima/ultima8/world/item_factory.cpp
+++ b/engines/ultima/ultima8/world/item_factory.cpp
@@ -64,12 +64,12 @@ Item *ItemFactory::createItem(uint32 shape, uint32 frame, uint16 quality,
Item *item = new Item();
item->setShape(shape);
- item->frame = frame;
- item->quality = quality;
- item->flags = flags;
- item->npcnum = npcnum;
- item->mapnum = mapnum;
- item->extendedflags = extendedflags;
+ item->_frame = frame;
+ item->_quality = quality;
+ item->_flags = flags;
+ item->_npcNum = npcnum;
+ item->_mapNum = mapnum;
+ item->_extendedFlags = extendedflags;
if (_objId) item->assignObjId();
return item;
}
@@ -79,12 +79,12 @@ Item *ItemFactory::createItem(uint32 shape, uint32 frame, uint16 quality,
Container *container = new Container();
container->setShape(shape);
- container->frame = frame;
- container->quality = quality;
- container->flags = flags;
- container->npcnum = npcnum;
- container->mapnum = mapnum;
- container->extendedflags = extendedflags;
+ container->_frame = frame;
+ container->_quality = quality;
+ container->_flags = flags;
+ container->_npcNum = npcnum;
+ container->_mapNum = mapnum;
+ container->_extendedFlags = extendedflags;
if (_objId) container->assignObjId();
return container;
}
@@ -94,12 +94,12 @@ Item *ItemFactory::createItem(uint32 shape, uint32 frame, uint16 quality,
GlobEgg *globegg = new GlobEgg();
globegg->setShape(shape);
- globegg->frame = frame;
- globegg->quality = quality;
- globegg->flags = flags;
- globegg->npcnum = npcnum;
- globegg->mapnum = mapnum;
- globegg->extendedflags = extendedflags;
+ globegg->_frame = frame;
+ globegg->_quality = quality;
+ globegg->_flags = flags;
+ globegg->_npcNum = npcnum;
+ globegg->_mapNum = mapnum;
+ globegg->_extendedFlags = extendedflags;
if (_objId) globegg->assignObjId();
return globegg;
}
@@ -107,12 +107,12 @@ Item *ItemFactory::createItem(uint32 shape, uint32 frame, uint16 quality,
case ShapeInfo::SF_UNKEGG: {
Egg *egg = new Egg();
egg->setShape(shape);
- egg->frame = frame;
- egg->quality = quality;
- egg->flags = flags;
- egg->npcnum = npcnum;
- egg->mapnum = mapnum;
- egg->extendedflags = extendedflags;
+ egg->_frame = frame;
+ egg->_quality = quality;
+ egg->_flags = flags;
+ egg->_npcNum = npcnum;
+ egg->_mapNum = mapnum;
+ egg->_extendedFlags = extendedflags;
if (_objId) egg->assignObjId();
return egg;
}
@@ -120,12 +120,12 @@ Item *ItemFactory::createItem(uint32 shape, uint32 frame, uint16 quality,
case ShapeInfo::SF_MONSTEREGG: {
MonsterEgg *egg = new MonsterEgg();
egg->setShape(shape);
- egg->frame = frame;
- egg->quality = quality;
- egg->flags = flags;
- egg->npcnum = npcnum;
- egg->mapnum = mapnum;
- egg->extendedflags = extendedflags;
+ egg->_frame = frame;
+ egg->_quality = quality;
+ egg->_flags = flags;
+ egg->_npcNum = npcnum;
+ egg->_mapNum = mapnum;
+ egg->_extendedFlags = extendedflags;
if (_objId) egg->assignObjId();
return egg;
}
@@ -133,12 +133,12 @@ Item *ItemFactory::createItem(uint32 shape, uint32 frame, uint16 quality,
case ShapeInfo::SF_TELEPORTEGG: {
TeleportEgg *egg = new TeleportEgg();
egg->setShape(shape);
- egg->frame = frame;
- egg->quality = quality;
- egg->flags = flags;
- egg->npcnum = npcnum;
- egg->mapnum = mapnum;
- egg->extendedflags = extendedflags;
+ egg->_frame = frame;
+ egg->_quality = quality;
+ egg->_flags = flags;
+ egg->_npcNum = npcnum;
+ egg->_mapNum = mapnum;
+ egg->_extendedFlags = extendedflags;
if (_objId) egg->assignObjId();
return egg;
}
@@ -169,30 +169,30 @@ Actor *ItemFactory::createActor(uint32 shape, uint32 frame, uint16 quality,
MainActor *actor = new MainActor();
actor->setShape(shape);
- actor->frame = frame;
- actor->quality = quality;
- actor->flags = flags;
- actor->npcnum = npcnum;
- actor->mapnum = mapnum;
+ actor->_frame = frame;
+ actor->_quality = quality;
+ actor->_flags = flags;
+ actor->_npcNum = npcnum;
+ actor->_mapNum = mapnum;
actor->_objId = 1;
- actor->extendedflags = extendedflags;
+ actor->_extendedFlags = extendedflags;
return actor;
}
// 'normal' Actor/NPC
Actor *actor = new Actor();
actor->setShape(shape);
- actor->frame = frame;
- actor->quality = quality;
- actor->flags = flags;
- actor->npcnum = npcnum;
- actor->mapnum = mapnum;
+ actor->_frame = frame;
+ actor->_quality = quality;
+ actor->_flags = flags;
+ actor->_npcNum = npcnum;
+ actor->_mapNum = mapnum;
if (npcnum != 0) {
actor->_objId = static_cast<uint16>(npcnum);
} else if (_objId) {
actor->assignObjId();
}
- actor->extendedflags = extendedflags;
+ actor->_extendedFlags = extendedflags;
return actor;
}
diff --git a/engines/ultima/ultima8/world/monster_egg.cpp b/engines/ultima/ultima8/world/monster_egg.cpp
index a03489e..bda0c24 100644
--- a/engines/ultima/ultima8/world/monster_egg.cpp
+++ b/engines/ultima/ultima8/world/monster_egg.cpp
@@ -76,7 +76,7 @@ uint16 MonsterEgg::hatch() {
<< ")." << Std::endl;
}
- if (!newactor->canExistAt(x, y, z)) {
+ if (!newactor->canExistAt(_x, _y, _z)) {
newactor->destroy();
return 0;
}
@@ -85,7 +85,7 @@ uint16 MonsterEgg::hatch() {
// newactor->getMapNum() when newactor is assaulted.
newactor->setMapNum(World::get_instance()->getCurrentMap()->getNum());
newactor->setNpcNum(objID);
- newactor->move(x, y, z);
+ newactor->move(_x, _y, _z);
newactor->cSetActivity(getActivity());
diff --git a/engines/ultima/ultima8/world/monster_egg.h b/engines/ultima/ultima8/world/monster_egg.h
index da6f2cd..c294aae 100644
--- a/engines/ultima/ultima8/world/monster_egg.h
+++ b/engines/ultima/ultima8/world/monster_egg.h
@@ -38,13 +38,13 @@ public:
ENABLE_RUNTIME_CLASSTYPE()
int getProb() const {
- return (quality >> 11) & 0x1F;
+ return (_quality >> 11) & 0x1F;
}
int getMonsterShape() const {
- return quality & 0x7FF;
+ return _quality & 0x7FF;
}
int getActivity() const {
- return mapnum & 0x07;
+ return _mapNum & 0x07;
}
uint16 hatch();
diff --git a/engines/ultima/ultima8/world/teleport_egg.cpp b/engines/ultima/ultima8/world/teleport_egg.cpp
index 43ee025..ee43033 100644
--- a/engines/ultima/ultima8/world/teleport_egg.cpp
+++ b/engines/ultima/ultima8/world/teleport_egg.cpp
@@ -50,7 +50,7 @@ uint16 TeleportEgg::hatch() {
perr << "Teleport!!!!!!!!" << Std::endl;
MainActor *av = getMainActor();
- av->teleport(mapnum, getTeleportId());
+ av->teleport(_mapNum, getTeleportId());
return 0;
}
diff --git a/engines/ultima/ultima8/world/teleport_egg.h b/engines/ultima/ultima8/world/teleport_egg.h
index 85b54f0..b62f1e4 100644
--- a/engines/ultima/ultima8/world/teleport_egg.h
+++ b/engines/ultima/ultima8/world/teleport_egg.h
@@ -37,10 +37,10 @@ public:
ENABLE_RUNTIME_CLASSTYPE()
bool isTeleporter() const {
- return frame != 1;
+ return _frame != 1;
}
int getTeleportId() const {
- return (quality & 0xFF);
+ return (_quality & 0xFF);
}
bool loadData(IDataSource *ids, uint32 version);
Commit: 2b934e06abc452f6c15f6f7be50c8b1188317e6c
https://github.com/scummvm/scummvm/commit/2b934e06abc452f6c15f6f7be50c8b1188317e6c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-17T19:42:21-08:00
Commit Message:
ULTIMA8: Renaming more world folder class fields
Changed paths:
engines/ultima/ultima8/graphics/wpn_ovlay_dat.cpp
engines/ultima/ultima8/world/actors/weapon_overlay.h
engines/ultima/ultima8/world/egg_hatcher_process.cpp
engines/ultima/ultima8/world/egg_hatcher_process.h
engines/ultima/ultima8/world/fireball_process.cpp
engines/ultima/ultima8/world/fireball_process.h
engines/ultima/ultima8/world/item_sorter.cpp
engines/ultima/ultima8/world/item_sorter.h
diff --git a/engines/ultima/ultima8/graphics/wpn_ovlay_dat.cpp b/engines/ultima/ultima8/graphics/wpn_ovlay_dat.cpp
index 402728c..6a02a17 100644
--- a/engines/ultima/ultima8/graphics/wpn_ovlay_dat.cpp
+++ b/engines/ultima/ultima8/graphics/wpn_ovlay_dat.cpp
@@ -98,9 +98,9 @@ void WpnOvlayDat::load(RawArchive *overlaydat) {
unsigned int offset = type * 8 * animlength
+ dir * animlength + frame;
ds->seek(4 * offset);
- f.xoff = ds->readXS(1);
- f.yoff = ds->readXS(1);
- f.frame = ds->read2();
+ f._xOff = ds->readXS(1);
+ f._yOff = ds->readXS(1);
+ f._frame = ds->read2();
awo->_overlay[type]._frames[dir][frame] = f;
}
diff --git a/engines/ultima/ultima8/world/actors/weapon_overlay.h b/engines/ultima/ultima8/world/actors/weapon_overlay.h
index 5d749d8..f77a3b4 100644
--- a/engines/ultima/ultima8/world/actors/weapon_overlay.h
+++ b/engines/ultima/ultima8/world/actors/weapon_overlay.h
@@ -29,9 +29,9 @@ namespace Ultima {
namespace Ultima8 {
struct WeaponOverlayFrame {
- int32 xoff;
- int32 yoff;
- uint32 frame;
+ int32 _xOff;
+ int32 _yOff;
+ uint32 _frame;
};
struct WeaponOverlay {
diff --git a/engines/ultima/ultima8/world/egg_hatcher_process.cpp b/engines/ultima/ultima8/world/egg_hatcher_process.cpp
index 35bd649..d739137 100644
--- a/engines/ultima/ultima8/world/egg_hatcher_process.cpp
+++ b/engines/ultima/ultima8/world/egg_hatcher_process.cpp
@@ -46,12 +46,12 @@ EggHatcherProcess::~EggHatcherProcess() {
}
void EggHatcherProcess::addEgg(uint16 egg) {
- eggs.push_back(egg);
+ _eggs.push_back(egg);
}
void EggHatcherProcess::addEgg(Egg *egg) {
assert(egg);
- eggs.push_back(egg->getObjId());
+ _eggs.push_back(egg->getObjId());
}
void EggHatcherProcess::run() {
@@ -59,8 +59,8 @@ void EggHatcherProcess::run() {
MainActor *av = getMainActor();
assert(av);
- for (unsigned int i = 0; i < eggs.size(); i++) {
- uint16 eggid = eggs[i];
+ for (unsigned int i = 0; i < _eggs.size(); i++) {
+ uint16 eggid = _eggs[i];
Egg *egg = p_dynamic_cast<Egg *>(getObject(eggid));
if (!egg) continue; // egg gone
@@ -81,8 +81,8 @@ void EggHatcherProcess::run() {
// 'justTeleported':
// if the avatar teleports, set the 'justTeleported' flag.
- // if this is set, don't hatch any teleport eggs
- // unset it when you're out of range of any teleport eggs
+ // if this is set, don't hatch any teleport _eggs
+ // unset it when you're out of range of any teleport _eggs
TeleportEgg *tegg = p_dynamic_cast<TeleportEgg *>(egg);
if (x1 <= ax && ax - axs < x2 && y1 <= ay && ay - ays < y2 &&
@@ -106,7 +106,7 @@ void EggHatcherProcess::saveData(ODataSource *ods) {
bool EggHatcherProcess::loadData(IDataSource *ids, uint32 version) {
if (!Process::loadData(ids, version)) return false;
- // the eggs will be re-added to the EggHatcherProcess when they're
+ // the _eggs will be re-added to the EggHatcherProcess when they're
// re-added to the CurrentMap
return true;
diff --git a/engines/ultima/ultima8/world/egg_hatcher_process.h b/engines/ultima/ultima8/world/egg_hatcher_process.h
index c2921ad..002b57c 100644
--- a/engines/ultima/ultima8/world/egg_hatcher_process.h
+++ b/engines/ultima/ultima8/world/egg_hatcher_process.h
@@ -48,7 +48,7 @@ public:
private:
void saveData(ODataSource *ods) override;
- Std::vector<uint16> eggs;
+ Std::vector<uint16> _eggs;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/fireball_process.cpp b/engines/ultima/ultima8/world/fireball_process.cpp
index 1c6d4d2..4195057 100644
--- a/engines/ultima/ultima8/world/fireball_process.cpp
+++ b/engines/ultima/ultima8/world/fireball_process.cpp
@@ -46,24 +46,24 @@ FireballProcess::FireballProcess()
}
-FireballProcess::FireballProcess(Item *item, Item *target_)
- : xspeed(0), yspeed(0), age(0) {
+FireballProcess::FireballProcess(Item *item, Item *target)
+ : _xSpeed(0), _ySpeed(0), _age(0) {
assert(item);
- assert(target_);
+ assert(target);
- tail[0] = 0;
- tail[1] = 0;
- tail[2] = 0;
+ _tail[0] = 0;
+ _tail[1] = 0;
+ _tail[2] = 0;
_itemNum = item->getObjId();
- target = target_->getObjId();
+ _target = target->getObjId();
_type = 0x218; // CONSTANT!
}
void FireballProcess::run() {
- age++;
+ _age++;
Item *item = getItem(_itemNum);
if (!item) {
@@ -71,23 +71,23 @@ void FireballProcess::run() {
return;
}
- Item *t = getItem(target);
+ Item *t = getItem(_target);
if (!t) {
terminate();
return;
}
- if (age > 300 && (getRandom() % 20 == 0)) {
+ if (_age > 300 && (getRandom() % 20 == 0)) {
// chance of 5% to disappear every frame after 10 seconds
terminate();
return;
}
- // * accelerate a bit towards target
+ // * accelerate a bit towards _target
// * try to move
// * if succesful:
// * move
- // * shift tail, enlarging if smaller than 3 flames
+ // * shift _tail, enlarging if smaller than 3 flames
// * if failed
// * deal damage if hit Actor
// * turn around if hit non-Actor
@@ -103,41 +103,41 @@ void FireballProcess::run() {
int targetdir = item->getDirToItemCentre(*t);
- if (xspeed == 0 && yspeed == 0 && dx / 64 == 0 && dy / 64 == 0) {
- xspeed += 2 * x_fact[targetdir];
- yspeed += 2 * y_fact[targetdir];
+ if (_xSpeed == 0 && _ySpeed == 0 && dx / 64 == 0 && dy / 64 == 0) {
+ _xSpeed += 2 * x_fact[targetdir];
+ _ySpeed += 2 * y_fact[targetdir];
} else {
- xspeed += (dx / 64);
- yspeed += (dy / 64);
+ _xSpeed += (dx / 64);
+ _ySpeed += (dy / 64);
}
// limit speed
- int speed = static_cast<int>(sqrt(static_cast<float>(xspeed * xspeed + yspeed * yspeed)));
+ int speed = static_cast<int>(sqrt(static_cast<float>(_xSpeed * _xSpeed + _ySpeed * _ySpeed)));
if (speed > 32) {
- xspeed = (xspeed * 32) / speed;
- yspeed = (yspeed * 32) / speed;
+ _xSpeed = (_xSpeed * 32) / speed;
+ _ySpeed = (_ySpeed * 32) / speed;
}
ObjId hititem = 0;
- item->collideMove(x + xspeed, y + yspeed, z, false, false, &hititem);
+ item->collideMove(x + _xSpeed, y + _ySpeed, z, false, false, &hititem);
- // handle tail
- // tail is shape 261, frame 0-7 (0 = to top-right, 7 = to top)
- if (tail[2] == 0) {
- // enlarge tail
+ // handle _tail
+ // _tail is shape 261, frame 0-7 (0 = to top-right, 7 = to top)
+ if (_tail[2] == 0) {
+ // enlarge _tail
Item *newtail = ItemFactory::createItem(261, 0, 0,
Item::FLG_DISPOSABLE, 0, 0,
Item::EXT_SPRITE, true);
- tail[2] = newtail->getObjId();
+ _tail[2] = newtail->getObjId();
}
- Item *tailitem = getItem(tail[2]);
- tailitem->setFrame(Get_WorldDirection(yspeed, xspeed));
+ Item *tailitem = getItem(_tail[2]);
+ tailitem->setFrame(Get_WorldDirection(_ySpeed, _xSpeed));
tailitem->move(x, y, z);
- tail[2] = tail[1];
- tail[1] = tail[0];
- tail[0] = tailitem->getObjId();
+ _tail[2] = _tail[1];
+ _tail[1] = _tail[0];
+ _tail[0] = tailitem->getObjId();
if (hititem) {
Actor *hit = getActor(hititem);
@@ -151,8 +151,8 @@ void FireballProcess::run() {
} else {
// hit an object: invert direction
- xspeed = -xspeed;
- yspeed = -yspeed;
+ _xSpeed = -_xSpeed;
+ _ySpeed = -_ySpeed;
}
}
}
@@ -169,7 +169,7 @@ void FireballProcess::explode() {
if (item) item->destroy();
for (unsigned int i = 0; i < 3; ++i) {
- item = getItem(tail[i]);
+ item = getItem(_tail[i]);
if (item) item->destroy();
}
}
@@ -206,25 +206,25 @@ uint32 FireballProcess::I_TonysBalls(const uint8 *args,
void FireballProcess::saveData(ODataSource *ods) {
Process::saveData(ods);
- ods->write4(static_cast<uint32>(xspeed));
- ods->write4(static_cast<uint32>(yspeed));
- ods->write2(target);
- ods->write2(tail[0]);
- ods->write2(tail[1]);
- ods->write2(tail[2]);
- ods->write2(age);
+ ods->write4(static_cast<uint32>(_xSpeed));
+ ods->write4(static_cast<uint32>(_ySpeed));
+ ods->write2(_target);
+ ods->write2(_tail[0]);
+ ods->write2(_tail[1]);
+ ods->write2(_tail[2]);
+ ods->write2(_age);
}
bool FireballProcess::loadData(IDataSource *ids, uint32 version) {
if (!Process::loadData(ids, version)) return false;
- xspeed = static_cast<int>(ids->read4());
- yspeed = static_cast<int>(ids->read4());
- target = ids->read2();
- tail[0] = ids->read2();
- tail[1] = ids->read2();
- tail[2] = ids->read2();
- age = ids->read2();
+ _xSpeed = static_cast<int>(ids->read4());
+ _ySpeed = static_cast<int>(ids->read4());
+ _target = ids->read2();
+ _tail[0] = ids->read2();
+ _tail[1] = ids->read2();
+ _tail[2] = ids->read2();
+ _age = ids->read2();
return true;
}
diff --git a/engines/ultima/ultima8/world/fireball_process.h b/engines/ultima/ultima8/world/fireball_process.h
index 1951669..942cca3 100644
--- a/engines/ultima/ultima8/world/fireball_process.h
+++ b/engines/ultima/ultima8/world/fireball_process.h
@@ -51,10 +51,10 @@ protected:
void explode();
- int xspeed, yspeed;
- ObjId tail[3];
- ObjId target;
- uint16 age;
+ int _xSpeed, _ySpeed;
+ ObjId _tail[3];
+ ObjId _target;
+ uint16 _age;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/item_sorter.cpp b/engines/ultima/ultima8/world/item_sorter.cpp
index 72e1747..4afec55 100644
--- a/engines/ultima/ultima8/world/item_sorter.cpp
+++ b/engines/ultima/ultima8/world/item_sorter.cpp
@@ -22,7 +22,6 @@
#include "ultima/ultima8/misc/pent_include.h"
#include "ultima/ultima8/world/item_sorter.h"
-
#include "ultima/ultima8/world/item.h"
#include "ultima/ultima8/graphics/shape.h"
#include "ultima/ultima8/graphics/shape_frame.h"
@@ -43,18 +42,18 @@ namespace Ultima8 {
// This does NOT need to be in the header
struct SortItem {
- SortItem(SortItem *n) : next(n), prev(0), item_num(0), shape(0), order(-1), depends() { }
+ SortItem(SortItem *n) : _next(n), _prev(0), _itemNum(0), _shape(0), _order(-1), _depends() { }
- SortItem *next;
- SortItem *prev;
+ SortItem *_next;
+ SortItem *_prev;
- uint16 item_num; // Owner item number
+ uint16 _itemNum; // Owner item number
- Shape *shape;
- uint32 shape_num;
- uint32 frame;
- uint32 flags; // Item flags
- uint32 ext_flags; // Item extended flags
+ Shape *_shape;
+ uint32 _shapeNum;
+ uint32 _frame;
+ uint32 _flags; // Item flags
+ uint32 _extFlags; // Item extended flags
int sx, sx2; // Screenspace X coords
int sy, sy2; // Screenspace Y coords
@@ -77,36 +76,36 @@ struct SortItem {
*/
- int32 x, xleft; // Worldspace bounding box x (xright = x)
- int32 y, yfar; // Worldspace bounding box y (ynear = y)
- int32 z, ztop; // Worldspace bounding box z (ztop = z)
+ int32 _x, _xLeft; // Worldspace bounding box x (xright = x)
+ int32 _y, _yFar; // Worldspace bounding box y (ynear = y)
+ int32 _z, _zTop; // Worldspace bounding box z (_zTop = z)
- int32 sxleft; // Screenspace bounding box left extent (LNT x coord)
- int32 sxright; // Screenspace bounding box right extent (RFT x coord)
+ int32 _sxLeft; // Screenspace bounding box left extent (LNT x coord)
+ int32 _sxRight; // Screenspace bounding box right extent (RFT x coord)
- int32 sxtop; // Screenspace bounding box top x coord (LFT x coord)
- int32 sytop; // Screenspace bounding box top extent (LFT y coord)
+ int32 _sxTop; // Screenspace bounding box top x coord (LFT x coord)
+ int32 _syTop; // Screenspace bounding box top extent (LFT y coord)
- int32 sxbot; // Screenspace bounding box bottom x coord (RNB x coord) ss origin
- int32 sybot; // Screenspace bounding box bottom extent (RNB y coord) ss origin
+ int32 _sxBot; // Screenspace bounding box bottom x coord (RNB x coord) ss origin
+ int32 _syBot; // Screenspace bounding box bottom extent (RNB y coord) ss origin
- bool f32x32 : 1; // Needs 1 bit 0
- bool flat : 1; // Needs 1 bit 1
- bool occl : 1; // Needs 1 bit 2
- bool solid : 1; // Needs 1 bit 3
- bool draw : 1; // Needs 1 bit 4
- bool roof : 1; // Needs 1 bit 5
- bool noisy : 1; // Needs 1 bit 6
- bool anim : 1; // Needs 1 bit 7
- bool trans : 1; // Needs 1 bit 8
- bool fixed : 1;
- bool land : 1;
+ bool _f32x32 : 1; // Needs 1 bit 0
+ bool _flat : 1; // Needs 1 bit 1
+ bool _occl : 1; // Needs 1 bit 2
+ bool _solid : 1; // Needs 1 bit 3
+ bool _draw : 1; // Needs 1 bit 4
+ bool _roof : 1; // Needs 1 bit 5
+ bool _noisy : 1; // Needs 1 bit 6
+ bool _anim : 1; // Needs 1 bit 7
+ bool _trans : 1; // Needs 1 bit 8
+ bool _fixed : 1;
+ bool _land : 1;
- bool occluded : 1; // Set true if occluded
+ bool _occluded : 1; // Set true if occluded
- int16 clipped; // Clipped to RenderSurface
+ int16 _clipped; // Clipped to RenderSurface
- int32 order; // Rendering order. -1 is not yet drawn
+ int32 _order; // Rendering _order. -1 is not yet drawn
// Note that Std::priority_queue could be used here, BUT there is no guarentee that it's implementation
// will be friendly to insertions
@@ -115,10 +114,10 @@ struct SortItem {
// So the only reasonable solution is to write my own list
struct DependsList {
struct Node {
- Node *next;
- Node *prev;
+ Node *_next;
+ Node *_prev;
SortItem *val;
- Node() : next(0), prev(0), val(0) { }
+ Node() : _next(0), _prev(0), val(0) { }
};
Node *list;
@@ -132,7 +131,7 @@ struct SortItem {
}
iterator(Node *node) : n(node) { }
iterator &operator++() {
- n = n->next;
+ n = n->_next;
return *this;
}
bool operator != (const iterator &o) {
@@ -149,7 +148,7 @@ struct SortItem {
void clear() {
if (tail) {
- tail->next = unused;
+ tail->_next = unused;
unused = list;
tail = 0;
list = 0;
@@ -159,40 +158,40 @@ struct SortItem {
void push_back(SortItem *other) {
if (!unused) unused = new Node();
Node *nn = unused;
- unused = unused->next;
+ unused = unused->_next;
nn->val = other;
// Put it at the end
- if (tail) tail->next = nn;
+ if (tail) tail->_next = nn;
if (!list) list = nn;
- nn->next = 0;
- nn->prev = tail;
+ nn->_next = 0;
+ nn->_prev = tail;
tail = nn;
}
void insert_sorted(SortItem *other) {
if (!unused) unused = new Node();
Node *nn = unused;
- unused = unused->next;
+ unused = unused->_next;
nn->val = other;
- for (Node *n = list; n != 0; n = n->next) {
+ for (Node *n = list; n != 0; n = n->_next) {
// Get the insert point... which is before the first item that has higher z than us
if (other->ListLessThan(n->val)) {
- nn->next = n;
- nn->prev = n->prev;
- n->prev = nn;
- if (nn->prev) nn->prev->next = nn;
+ nn->_next = n;
+ nn->_prev = n->_prev;
+ n->_prev = nn;
+ if (nn->_prev) nn->_prev->_next = nn;
else list = nn;
return;
}
}
// No suitable, so put at end
- if (tail) tail->next = nn;
+ if (tail) tail->_next = nn;
if (!list) list = nn;
- nn->next = 0;
- nn->prev = tail;
+ nn->_next = 0;
+ nn->_prev = tail;
tail = nn;
}
@@ -201,16 +200,16 @@ struct SortItem {
~DependsList() {
clear();
while (unused) {
- Node *n = unused->next;
+ Node *n = unused->_next;
delete unused;
unused = n;
}
}
};
- //Std::vector<SortItem *> depends; // All this Items dependencies (i.e. all objects behind)
- //Std::list<SortItem *> depends; // All this Items dependencies (i.e. all objects behind)
- DependsList depends;
+ //Std::vector<SortItem *> _depends; // All this Items dependencies (i.e. all objects behind)
+ //Std::list<SortItem *> _depends; // All this Items dependencies (i.e. all objects behind)
+ DependsList _depends;
// Functions
@@ -228,17 +227,17 @@ struct SortItem {
// Comparison for the sorted lists
inline bool ListLessThan(const SortItem *other) const {
- return z < other->z ||
- (z == other->z && x < other->x) ||
- (z == other->z && x == other->x && y < other->y);
+ return _z < other->_z ||
+ (_z == other->_z && _x < other->_x) ||
+ (_z == other->_z && _x == other->_x && _y < other->_y);
}
};
// Check to see if we overlap si2
inline bool SortItem::overlap(const SortItem &si2) const {
- const int point_top_diff[2] = { sxtop - si2.sxbot, sytop - si2.sybot };
- const int point_bot_diff[2] = { sxbot - si2.sxtop, sybot - si2.sytop };
+ const int point_top_diff[2] = { _sxTop - si2._sxBot, _syTop - si2._syBot };
+ const int point_bot_diff[2] = { _sxBot - si2._sxTop, _syBot - si2._syTop };
// This function is a bit of a hack. It uses dot products between
// points and the lines. Nothing is normalized since that isn't
@@ -256,8 +255,8 @@ inline bool SortItem::overlap(const SortItem &si2) const {
// 'normal' of bot right line (-2, 1) of the bounding box
const int32 dot_bot_right = -point_bot_diff[0] - point_bot_diff[1] * 2;
- const bool right_clear = sxright <= si2.sxleft;
- const bool left_clear = sxleft >= si2.sxright;
+ const bool right_clear = _sxRight <= si2._sxLeft;
+ const bool left_clear = _sxLeft >= si2._sxRight;
const bool top_left_clear = dot_top_left >= 0;
const bool top_right_clear = dot_top_right >= 0;
const bool bot_left_clear = dot_bot_left >= 0;
@@ -272,8 +271,8 @@ inline bool SortItem::overlap(const SortItem &si2) const {
// Check to see if we occlude si2
inline bool SortItem::occludes(const SortItem &si2) const {
- const int point_top_diff[2] = { sxtop - si2.sxtop, sytop - si2.sytop };
- const int point_bot_diff[2] = { sxbot - si2.sxbot, sybot - si2.sybot };
+ const int point_top_diff[2] = { _sxTop - si2._sxTop, _syTop - si2._syTop };
+ const int point_bot_diff[2] = { _sxBot - si2._sxBot, _syBot - si2._syBot };
// This function is a bit of a hack. It uses dot products between
// points and the lines. Nothing is normalized since that isn't
@@ -292,8 +291,8 @@ inline bool SortItem::occludes(const SortItem &si2) const {
const int32 dot_bot_right = -point_bot_diff[0] - point_bot_diff[1] * 2;
- const bool right_res = sxright >= si2.sxright;
- const bool left_res = sxleft <= si2.sxleft;
+ const bool right_res = _sxRight >= si2._sxRight;
+ const bool left_res = _sxLeft <= si2._sxLeft;
const bool top_left_res = dot_top_left <= 0;
const bool top_right_res = dot_top_right <= 0;
const bool bot_left_res = dot_bot_left <= 0;
@@ -307,65 +306,65 @@ inline bool SortItem::operator<(const SortItem &si2) const {
const SortItem &si1 = *this;
// Specialist z flat handling
- if (si1.flat && si2.flat) {
+ if (si1._flat && si2._flat) {
// Differing z is easy for flats
- if (si1.ztop != si2.ztop) return si1.ztop < si2.ztop;
+ if (si1._zTop != si2._zTop) return si1._zTop < si2._zTop;
// Equal z
// Animated always gets drawn after
- if (si1.anim != si2.anim) return si1.anim < si2.anim;
+ if (si1._anim != si2._anim) return si1._anim < si2._anim;
// Trans always gets drawn after
- if (si1.trans != si2.trans) return si1.trans < si2.trans;
+ if (si1._trans != si2._trans) return si1._trans < si2._trans;
// Draw always gets drawn first
- if (si1.draw != si2.draw) return si1.draw > si2.draw;
+ if (si1._draw != si2._draw) return si1._draw > si2._draw;
// Solid always gets drawn first
- if (si1.solid != si2.solid) return si1.solid > si2.solid;
+ if (si1._solid != si2._solid) return si1._solid > si2._solid;
// Occludes always get drawn first
- if (si1.occl != si2.occl) return si1.occl > si2.occl;
+ if (si1._occl != si2._occl) return si1._occl > si2._occl;
// 32x32 flats get drawn first
- if (si1.f32x32 != si2.f32x32) return si1.f32x32 > si2.f32x32;
+ if (si1._f32x32 != si2._f32x32) return si1._f32x32 > si2._f32x32;
}
// Mixed, or non flat
else {
// Clearly X, Y and Z (useful?)
- //if (si1.x <= si2.xleft && si1.y <= si2.yfar && si1.ztop <= si2.z) return true;
- //else if (si1.xleft >= si2.x && si1.yfar >= si2.y && si1.z >= si2.ztop) return false;
+ //if (si1._x <= si2._xLeft && si1._y <= si2._yFar && si1._zTop <= si2._z) return true;
+ //else if (si1._xLeft >= si2._x && si1._yFar >= si2._y && si1._z >= si2._zTop) return false;
- //int front1 = si1.x + si1.y;
- //int rear1 = si1.xleft + si1.yfar;
- //int front2 = si2.x + si2.y;
- //int rear2 = si2.xleft + si2.yfar;
+ //int front1 = si1._x + si1._y;
+ //int rear1 = si1._xLeft + si1._yFar;
+ //int front2 = si2._x + si2._y;
+ //int rear2 = si2._xLeft + si2._yFar;
// Rear of object is infront of other's front
//if (front1 <= rear2) return true;
//else if (rear1 >= front2) return false;
// Clearly in z
- if (si1.ztop <= si2.z) return true;
- else if (si1.z >= si2.ztop) return false;
+ if (si1._zTop <= si2._z) return true;
+ else if (si1._z >= si2._zTop) return false;
// Partial in z
- //if (si1.ztop != si2.ztop) return si1.ztop < si2.ztop;
+ //if (si1._zTop != si2._zTop) return si1._zTop < si2._zTop;
}
// Clearly in x and y? (useful?)
- //if (si1.x <= si2.xleft && si1.y <= si2.yfar) return true;
- //else if (si1.xleft >= si2.x && si1.yfar >= si2.y) return false;
+ //if (si1._x <= si2._xLeft && si1._y <= si2._yFar) return true;
+ //else if (si1._xLeft >= si2._x && si1._yFar >= si2._y) return false;
// Clearly in x?
- if (si1.x <= si2.xleft) return true;
- else if (si1.xleft >= si2.x) return false;
+ if (si1._x <= si2._xLeft) return true;
+ else if (si1._xLeft >= si2._x) return false;
// Clearly in y?
- if (si1.y <= si2.yfar) return true;
- else if (si1.yfar >= si2.y) return false;
+ if (si1._y <= si2._yFar) return true;
+ else if (si1._yFar >= si2._y) return false;
// Are overlapping in all 3 dimentions if we come here
@@ -373,38 +372,38 @@ inline bool SortItem::operator<(const SortItem &si2) const {
// If an object's base (z-bottom) is higher another's, it should be rendered after.
// This check must be on the z-bottom and not the z-top because two objects with the
// same z-position may have different heights (think of a mouse sorting vs the Avatar).
- if (si1.z < si2.z) return true;
- else if (si1.z > si2.z) return false;
+ if (si1._z < si2._z) return true;
+ else if (si1._z > si2._z) return false;
// Biased Clearly in z
- if ((si1.ztop + si1.z) / 2 <= si2.z) return true;
- else if (si1.z >= (si2.ztop + si2.z) / 2) return false;
+ if ((si1._zTop + si1._z) / 2 <= si2._z) return true;
+ else if (si1._z >= (si2._zTop + si2._z) / 2) return false;
// Biased Clearly X
- if ((si1.x + si1.xleft) / 2 <= si2.xleft) return true;
- else if (si1.xleft >= (si2.x + si2.xleft) / 2) return false;
+ if ((si1._x + si1._xLeft) / 2 <= si2._xLeft) return true;
+ else if (si1._xLeft >= (si2._x + si2._xLeft) / 2) return false;
// Biased Clearly Y
- if ((si1.y + si1.yfar) / 2 <= si2.yfar) return true;
- else if (si1.yfar >= (si2.y + si2.yfar) / 2) return false;
+ if ((si1._y + si1._yFar) / 2 <= si2._yFar) return true;
+ else if (si1._yFar >= (si2._y + si2._yFar) / 2) return false;
// Partial in X + Y front
- if (si1.x + si1.y != si2.x + si2.y) return (si1.x + si1.y < si2.x + si2.y);
+ if (si1._x + si1._y != si2._x + si2._y) return (si1._x + si1._y < si2._x + si2._y);
// Partial in X + Y back
- if (si1.xleft + si1.yfar != si2.xleft + si2.yfar) return (si1.xleft + si1.yfar < si2.xleft + si2.yfar);
+ if (si1._xLeft + si1._yFar != si2._xLeft + si2._yFar) return (si1._xLeft + si1._yFar < si2._xLeft + si2._yFar);
// Partial in x?
- if (si1.x != si2.x) return si1.x < si2.x;
+ if (si1._x != si2._x) return si1._x < si2._x;
// Partial in y?
- if (si1.y != si2.y) return si1.y < si2.y;
+ if (si1._y != si2._y) return si1._y < si2._y;
- // Just sort by shape number - not a number any more (is a pointer)
- if (si1.shape_num != si2.shape_num) return si1.shape_num < si2.shape_num;
+ // Just sort by _shape number - not a number any more (is a pointer)
+ if (si1._shapeNum != si2._shapeNum) return si1._shapeNum < si2._shapeNum;
- // And then by frame
- return si1.frame < si2.frame;
+ // And then by _frame
+ return si1._frame < si2._frame;
}
#define COMPARISON_RETURN(val,op,tab) \
@@ -457,41 +456,41 @@ inline bool SortItem::operator<<(const SortItem &si2) const {
}
// Specialist z flat handling
- pout << "if (si1.flat && si2.flat) -> if ("
- << si1.flat << " && " << si2.flat << ") -> "
- << (si1.flat && si2.flat) << Std::endl;
+ pout << "if (si1._flat && si2._flat) -> if ("
+ << si1._flat << " && " << si2._flat << ") -> "
+ << (si1._flat && si2._flat) << Std::endl;
pout << "{" << Std::endl;
- if (si1.flat && si2.flat) {
+ if (si1._flat && si2._flat) {
// Differing z is easy for flats
- //if (si1.ztop != si2.ztop) return si1.ztop < si2.ztop;
- COMPARISON_RETURN(ztop, <, "\t");
+ //if (si1._zTop != si2._zTop) return si1._zTop < si2._zTop;
+ COMPARISON_RETURN(_zTop, <, "\t");
// Equal z
// Animated always gets drawn after
- //if (si1.anim != si2.anim) return si1.anim < si2.anim;
- COMPARISON_RETURN(anim, <, "\t");
+ //if (si1._anim != si2._anim) return si1._anim < si2._anim;
+ COMPARISON_RETURN(_anim, <, "\t");
// Trans always gets drawn after
- //if (si1.trans != si2.trans) return si1.trans < si2.trans;
- COMPARISON_RETURN(trans, <, "\t");
+ //if (si1._trans != si2._trans) return si1._trans < si2._trans;
+ COMPARISON_RETURN(_trans, <, "\t");
// Draw always gets drawn first
- //if (si1.draw != si2.draw) return si1.draw > si2.draw;
- COMPARISON_RETURN(draw, >, "\t");
+ //if (si1._draw != si2._draw) return si1._draw > si2._draw;
+ COMPARISON_RETURN(_draw, >, "\t");
// Solid always gets drawn first
- //if (si1.solid != si2.solid) return si1.solid > si2.solid;
- COMPARISON_RETURN(solid, >, "\t");
+ //if (si1._solid != si2._solid) return si1._solid > si2._solid;
+ COMPARISON_RETURN(_solid, >, "\t");
// Occludes always get drawn first
- //if (si1.occl != si2.occl) return si1.occl > si2.occl;
- COMPARISON_RETURN(occl, >, "\t");
+ //if (si1._occl != si2._occl) return si1._occl > si2._occl;
+ COMPARISON_RETURN(_occl, >, "\t");
// 32x32 flats get drawn first
- //if (si1.f32x32 != si2.f32x32) return si1.f32x32 > si2.f32x32;
- COMPARISON_RETURN(f32x32, >, "\t");
+ //if (si1._f32x32 != si2._f32x32) return si1._f32x32 > si2._f32x32;
+ COMPARISON_RETURN(_f32x32, >, "\t");
}
// Mixed, or non flat
else {
@@ -500,13 +499,13 @@ inline bool SortItem::operator<<(const SortItem &si2) const {
pout << "{" << Std::endl;
// Clearly X, Y and Z (useful?)
- //if (si1.x <= si2.xleft && si1.y <= si2.yfar && si1.ztop <= si2.z) return true;
- //else if (si1.xleft >= si2.x && si1.yfar >= si2.y && si1.z >= si2.ztop) return false;
+ //if (si1._x <= si2._xLeft && si1._y <= si2._yFar && si1._zTop <= si2._z) return true;
+ //else if (si1._xLeft >= si2._x && si1._yFar >= si2._y && si1._z >= si2._zTop) return false;
- //int front1 = si1.x + si1.y;
- //int rear1 = si1.xleft + si1.yfar;
- //int front2 = si2.x + si2.y;
- //int rear2 = si2.xleft + si2.yfar;
+ //int front1 = si1._x + si1._y;
+ //int rear1 = si1._xLeft + si1._yFar;
+ //int front2 = si2._x + si2._y;
+ //int rear2 = si2._xLeft + si2._yFar;
// Rear of object is infront of other's front
//if (front1 <= rear2) return true;
@@ -515,77 +514,77 @@ inline bool SortItem::operator<<(const SortItem &si2) const {
//COMPARISON_RETURN_TF(rear1,>=,front2,false,"\t");
// Clearly in z
- //if (si1.ztop <= si2.z) return true;
- //else if (si1.z >= si2.ztop) return false;
- COMPARISON_RETURN_TF(si1.ztop, <=, si2.z, true, "\t");
- COMPARISON_RETURN_TF(si1.z, >=, si2.ztop, false, "\t");
+ //if (si1._zTop <= si2._z) return true;
+ //else if (si1._z >= si2._zTop) return false;
+ COMPARISON_RETURN_TF(si1._zTop, <=, si2._z, true, "\t");
+ COMPARISON_RETURN_TF(si1._z, >=, si2._zTop, false, "\t");
// Partial in z
- //if (si1.ztop != si2.ztop) return si1.ztop < si2.ztop;
+ //if (si1._zTop != si2._zTop) return si1._zTop < si2._zTop;
}
pout << "}" << Std::endl;
// Clearly in x and y? (useful?)
- //if (si1.x <= si2.xleft && si1.y <= si2.yfar) return true;
- //else if (si1.xleft >= si2.x && si1.yfar >= si2.y) return false;
+ //if (si1._x <= si2._xLeft && si1._y <= si2._yFar) return true;
+ //else if (si1._xLeft >= si2._x && si1._yFar >= si2._y) return false;
// Clearly X
- //if (si1.x <= si2.xleft) return true;
- //else if (si1.xleft >= si2.x) return false;
- COMPARISON_RETURN_TF(si1.x, <=, si2.xleft, true, "\t");
- COMPARISON_RETURN_TF(si1.xleft, >=, si2.x, false, "\t");
+ //if (si1._x <= si2._xLeft) return true;
+ //else if (si1._xLeft >= si2._x) return false;
+ COMPARISON_RETURN_TF(si1._x, <=, si2._xLeft, true, "\t");
+ COMPARISON_RETURN_TF(si1._xLeft, >=, si2._x, false, "\t");
// Clearly Y
- //if (si1.y <= si2.yfar) return true;
- //else if (si1.yfar >= si2.y) return false;
- COMPARISON_RETURN_TF(si1.y, <=, si2.yfar, true, "\t");
- COMPARISON_RETURN_TF(si1.yfar, >=, si2.y, false, "\t");
+ //if (si1._y <= si2._yFar) return true;
+ //else if (si1._yFar >= si2._y) return false;
+ COMPARISON_RETURN_TF(si1._y, <=, si2._yFar, true, "\t");
+ COMPARISON_RETURN_TF(si1._yFar, >=, si2._y, false, "\t");
// Z base
- COMPARISON_RETURN_TF(si1.z, <, si2.z, true, "");
- COMPARISON_RETURN_TF(si1.z, >, si2.z, false, "");
+ COMPARISON_RETURN_TF(si1._z, <, si2._z, true, "");
+ COMPARISON_RETURN_TF(si1._z, >, si2._z, false, "");
// Biased Clearly in z
- //if ((si1.ztop+si1.z)/2 <= si2.z) return true;
- //else if (si1.z >= (si2.ztop+si2.z)/2) return false;
- COMPARISON_RETURN_TF((si1.ztop + si1.z) / 2, <=, si2.z, true, "");
- COMPARISON_RETURN_TF(si1.z, >=, (si2.ztop + si2.z) / 2, false, "");
+ //if ((si1._zTop+si1._z)/2 <= si2._z) return true;
+ //else if (si1._z >= (si2._zTop+si2._z)/2) return false;
+ COMPARISON_RETURN_TF((si1._zTop + si1._z) / 2, <=, si2._z, true, "");
+ COMPARISON_RETURN_TF(si1._z, >=, (si2._zTop + si2._z) / 2, false, "");
// Biased Clearly X
- //if ((si1.x+si1.xleft)/2 <= si2.xleft) return true;
- //else if (si1.xleft >= (si2.x+si2.xleft)/2) return false;
- COMPARISON_RETURN_TF((si1.x + si1.xleft) / 2, <=, si2.xleft, true, "");
- COMPARISON_RETURN_TF(si1.xleft, >=, (si2.x + si2.xleft) / 2, false, "");
+ //if ((si1._x+si1._xLeft)/2 <= si2._xLeft) return true;
+ //else if (si1._xLeft >= (si2._x+si2._xLeft)/2) return false;
+ COMPARISON_RETURN_TF((si1._x + si1._xLeft) / 2, <=, si2._xLeft, true, "");
+ COMPARISON_RETURN_TF(si1._xLeft, >=, (si2._x + si2._xLeft) / 2, false, "");
// Biased Clearly Y
- //if ((si1.y+si1.yfar)/2 <= si2.yfar) return true;
- //else if (si1.yfar >= (si2.y+si2.yfar)/2) return false;
- COMPARISON_RETURN_TF((si1.y + si1.yfar) / 2, <=, si2.yfar, true, "");
- COMPARISON_RETURN_TF(si1.yfar, >=, (si2.y + si2.yfar) / 2, false, "");
+ //if ((si1._y+si1._yFar)/2 <= si2._yFar) return true;
+ //else if (si1._yFar >= (si2._y+si2._yFar)/2) return false;
+ COMPARISON_RETURN_TF((si1._y + si1._yFar) / 2, <=, si2._yFar, true, "");
+ COMPARISON_RETURN_TF(si1._yFar, >=, (si2._y + si2._yFar) / 2, false, "");
// Partial in X + Y front
- //if (si1.x + si1.y != si2.x + si2.y) return (si1.x + si1.y < si2.x + si2.y);
- COMPARISON_RETURN_EX(si1.x + si1.y, <, si2.x + si2.y, "");
+ //if (si1._x + si1._y != si2._x + si2._y) return (si1._x + si1._y < si2._x + si2._y);
+ COMPARISON_RETURN_EX(si1._x + si1._y, <, si2._x + si2._y, "");
// Partial in X + Y back
- //if (si1.xleft + si1.yfar != si2.xleft + si2.yfar) return (si1.xleft + si1.yfar < si2.xleft + si2.yfar);
- COMPARISON_RETURN_EX(si1.xleft + si1.yfar, <, si2.xleft + si2.yfar, "");
+ //if (si1._xLeft + si1._yFar != si2._xLeft + si2._yFar) return (si1._xLeft + si1._yFar < si2._xLeft + si2._yFar);
+ COMPARISON_RETURN_EX(si1._xLeft + si1._yFar, <, si2._xLeft + si2._yFar, "");
// Partial in x?
- //if (si1.x != si2.x) return si1.x < si2.x;
- COMPARISON_RETURN(x, <, "");
+ //if (si1._x != si2._x) return si1._x < si2._x;
+ COMPARISON_RETURN(_x, <, "");
// Partial in y?
- //if (si1.y != si2.y) return si1.y < si2.y;
- COMPARISON_RETURN(y, <, "");
+ //if (si1._y != si2._y) return si1._y < si2._y;
+ COMPARISON_RETURN(_y, <, "");
- // Just sort by shape number
-// if (si1.shape_num != si2.shape_num) return si1.shape_num < si2.shape_num;
- COMPARISON_RETURN(shape_num, <, "");
+ // Just sort by _shape number
+// if (si1._shapeNum != si2._shapeNum) return si1._shapeNum < si2._shapeNum;
+ COMPARISON_RETURN(_shapeNum, <, "");
- // And then by frame
- //return si1.frame < si2.frame;
- COMPARISON_RETURN(frame, <, "");
+ // And then by _frame
+ //return si1._frame < si2._frame;
+ COMPARISON_RETURN(_frame, <, "");
return 0;
}
@@ -595,83 +594,83 @@ inline bool SortItem::operator<<(const SortItem &si2) const {
//
ItemSorter::ItemSorter() :
- shapes(0), surf(0), items(0), items_tail(0), items_unused(0), sort_limit(0) {
+ _shapes(0), _surf(0), _items(0), _itemsTail(0), _itemsUnused(0), _sortLimit(0) {
int i = 2048;
- while (i--) items_unused = new SortItem(items_unused);
+ while (i--) _itemsUnused = new SortItem(_itemsUnused);
}
ItemSorter::~ItemSorter() {
//
- if (items_tail) {
- items_tail->next = items_unused;
- items_unused = items;
+ if (_itemsTail) {
+ _itemsTail->_next = _itemsUnused;
+ _itemsUnused = _items;
}
- items = 0;
- items_tail = 0;
+ _items = 0;
+ _itemsTail = 0;
- while (items_unused) {
- SortItem *next = items_unused->next;
- delete items_unused;
- items_unused = next;
+ while (_itemsUnused) {
+ SortItem *_next = _itemsUnused->_next;
+ delete _itemsUnused;
+ _itemsUnused = _next;
}
- delete [] items;
+ delete [] _items;
}
void ItemSorter::BeginDisplayList(RenderSurface *rs,
int32 camx, int32 camy, int32 camz) {
- // Get the shapes, if required
- if (!shapes) shapes = GameData::get_instance()->getMainShapes();
+ // Get the _shapes, if required
+ if (!_shapes) _shapes = GameData::get_instance()->getMainShapes();
//
- if (items_tail) {
- items_tail->next = items_unused;
- items_unused = items;
+ if (_itemsTail) {
+ _itemsTail->_next = _itemsUnused;
+ _itemsUnused = _items;
}
- items = 0;
- items_tail = 0;
+ _items = 0;
+ _itemsTail = 0;
// Set the RenderSurface, and reset the item list
- surf = rs;
- order_counter = 0;
+ _surf = rs;
+ _orderCounter = 0;
// Screenspace bounding box bottom x coord (RNB x coord)
- cam_sx = (camx - camy) / 4;
+ _camSx = (camx - camy) / 4;
// Screenspace bounding box bottom extent (RNB y coord)
- cam_sy = (camx + camy) / 8 - camz;
+ _camSy = (camx + camy) / 8 - camz;
}
-void ItemSorter::AddItem(int32 x, int32 y, int32 z, uint32 shape_num, uint32 frame_num, uint32 flags, uint32 ext_flags, uint16 item_num) {
+void ItemSorter::AddItem(int32 x, int32 y, int32 z, uint32 _shapeNum, uint32 frame_num, uint32 flags, uint32 ext_flags, uint16 _itemNum) {
//if (z > skip_lift) return;
- //if (Application::tgwds && shape == 538) return;
+ //if (Application::tgwds && _shape == 538) return;
// First thing, get a SortItem to use (first of unused)
- if (!items_unused) items_unused = new SortItem(0);
- SortItem *si = items_unused;
-
- si->item_num = item_num;
- si->shape = shapes->getShape(shape_num);
- si->shape_num = shape_num;
- si->frame = frame_num;
- ShapeFrame *frame = si->shape->getFrame(si->frame);
- if (!frame) {
- perr << "Invalid shape: " << si->shape_num << "," << si->frame
+ if (!_itemsUnused) _itemsUnused = new SortItem(0);
+ SortItem *si = _itemsUnused;
+
+ si->_itemNum = _itemNum;
+ si->_shape = _shapes->getShape(_shapeNum);
+ si->_shapeNum = _shapeNum;
+ si->_frame = frame_num;
+ ShapeFrame *_frame = si->_shape->getFrame(si->_frame);
+ if (!_frame) {
+ perr << "Invalid _shape: " << si->_shapeNum << "," << si->_frame
<< Std::endl;
return;
}
- ShapeInfo *info = shapes->getShapeInfo(shape_num);
+ ShapeInfo *info = _shapes->getShapeInfo(_shapeNum);
//if (info->is_editor && !show_editor_items) return;
//if (info->z > shape_max_height) return;
// Dimensions
int32 xd, yd, zd;
- si->flags = flags;
- si->ext_flags = ext_flags;
+ si->_flags = flags;
+ si->_extFlags = ext_flags;
// X and Y are flipped
- if (si->flags & Item::FLG_FLIPPED) {
+ if (si->_flags & Item::FLG_FLIPPED) {
xd = info->_y * 32; // Multiply by 32 to get actual world size
yd = info->_x * 32; // Multiply by 32 to get actual world size
} else {
@@ -682,133 +681,133 @@ void ItemSorter::AddItem(int32 x, int32 y, int32 z, uint32 shape_num, uint32 fra
zd = info->_z * 8; // Multiply by 8 to get actual world size
// Worldspace bounding box
- si->x = x;
- si->y = y;
- si->z = z;
- si->xleft = si->x - xd;
- si->yfar = si->y - yd;
- si->ztop = si->z + zd;
+ si->_x = x;
+ si->_y = y;
+ si->_z = z;
+ si->_xLeft = si->_x - xd;
+ si->_yFar = si->_y - yd;
+ si->_zTop = si->_z + zd;
// Screenspace bounding box left extent (LNT x coord)
- si->sxleft = si->xleft / 4 - si->y / 4 - cam_sx;
+ si->_sxLeft = si->_xLeft / 4 - si->_y / 4 - _camSx;
// Screenspace bounding box right extent (RFT x coord)
- si->sxright = si->x / 4 - si->yfar / 4 - cam_sx;
+ si->_sxRight = si->_x / 4 - si->_yFar / 4 - _camSx;
// Screenspace bounding box top x coord (LFT x coord)
- si->sxtop = si->xleft / 4 - si->yfar / 4 - cam_sx;
+ si->_sxTop = si->_xLeft / 4 - si->_yFar / 4 - _camSx;
// Screenspace bounding box top extent (LFT y coord)
- si->sytop = si->xleft / 8 + si->yfar / 8 - si->ztop - cam_sy;
+ si->_syTop = si->_xLeft / 8 + si->_yFar / 8 - si->_zTop - _camSy;
// Screenspace bounding box bottom x coord (RNB x coord)
- si->sxbot = si->x / 4 - si->y / 4 - cam_sx;
+ si->_sxBot = si->_x / 4 - si->_y / 4 - _camSx;
// Screenspace bounding box bottom extent (RNB y coord)
- si->sybot = si->x / 8 + si->y / 8 - si->z - cam_sy;
+ si->_syBot = si->_x / 8 + si->_y / 8 - si->_z - _camSy;
-// si->sxleft += swo2;
-// si->sxright += swo2;
-// si->sxbot += swo2;
-// si->sxtop += swo2;
+// si->_sxLeft += swo2;
+// si->_sxRight += swo2;
+// si->_sxBot += swo2;
+// si->_sxTop += swo2;
-// si->sytop += sho2;
-// si->sybot += sho2;
+// si->_syTop += sho2;
+// si->_syBot += sho2;
// Real Screenspace coords
- si->sx = si->sxbot - frame->_xoff; // Left
- si->sy = si->sybot - frame->_yoff; // Top
- si->sx2 = si->sx + frame->_width; // Right
- si->sy2 = si->sy + frame->_height; // Bottom
+ si->sx = si->_sxBot - _frame->_xoff; // Left
+ si->sy = si->_syBot - _frame->_yoff; // Top
+ si->sx2 = si->sx + _frame->_width; // Right
+ si->sy2 = si->sy + _frame->_height; // Bottom
// Do Clipping here
- si->clipped = surf->CheckClipped(Rect(si->sx, si->sy, frame->_width, frame->_height));
- if (si->clipped < 0) return;
+ si->_clipped = _surf->CheckClipped(Rect(si->sx, si->sy, _frame->_width, _frame->_height));
+ if (si->_clipped < 0) return;
// These help out with sorting. We calc them now, so it will be faster
- si->f32x32 = xd == 128 && yd == 128;
- si->flat = zd == 0;
+ si->_f32x32 = xd == 128 && yd == 128;
+ si->_flat = zd == 0;
/*
if (Application::tgwds) {
- si->draw = false;
- si->solid = false;
- si->occl = false;
+ si->_draw = false;
+ si->_solid = false;
+ si->_occl = false;
si->roof = false;
si->noisy = false;
- si->anim = false;
- si->trans = false;
+ si->_anim = false;
+ si->_trans = false;
}
else
*/
{
- si->draw = info->is_draw();
- si->solid = info->is_solid();
- si->occl = info->is_occl() && !(si->flags & Item::FLG_INVISIBLE) &&
- !(si->ext_flags & Item::EXT_TRANSPARENT);
- si->roof = info->is_roof();
- si->noisy = info->is_noisy();
- si->anim = info->_animType != 0;
- si->trans = info->is_translucent();
- si->fixed = info->is_fixed();
- si->land = info->is_land();
+ si->_draw = info->is_draw();
+ si->_solid = info->is_solid();
+ si->_occl = info->is_occl() && !(si->_flags & Item::FLG_INVISIBLE) &&
+ !(si->_extFlags & Item::EXT_TRANSPARENT);
+ si->_roof = info->is_roof();
+ si->_noisy = info->is_noisy();
+ si->_anim = info->_animType != 0;
+ si->_trans = info->is_translucent();
+ si->_fixed = info->is_fixed();
+ si->_land = info->is_land();
}
- si->occluded = false;
- si->order = -1;
+ si->_occluded = false;
+ si->_order = -1;
// We will clear all the vector memory
// Stictly speaking the vector will sort of leak memory, since they
// are never deleted
- si->depends.clear();
- //si->depends.erase(si->depends.begin(), si->depends.end()); // MSVC.Netism
+ si->_depends.clear();
+ //si->_depends.erase(si->_depends.begin(), si->_depends.end()); // MSVC.Netism
- // Iterate the list and compare shapes
+ // Iterate the list and compare _shapes
// Ok,
SortItem *addpoint = 0;
- for (SortItem *si2 = items; si2 != 0; si2 = si2->next) {
+ for (SortItem *si2 = _items; si2 != 0; si2 = si2->_next) {
// Get the insert point... which is before the first item that has higher z than us
if (!addpoint && si->ListLessThan(si2)) addpoint = si2;
// Doesn't overlap
- if (si2->occluded || !si->overlap(*si2)) continue;
+ if (si2->_occluded || !si->overlap(*si2)) continue;
// Attempt to find which is infront
if (*si < *si2) {
// si2 occludes si (us)
- if (si2->occl && si2->occludes(*si)) {
+ if (si2->_occl && si2->occludes(*si)) {
// No need to do any more checks, this isn't visible
- si->occluded = true;
+ si->_occluded = true;
break;
}
// si1 is behind si2, so add it to si2's dependency list
- si2->depends.insert_sorted(si);
+ si2->_depends.insert_sorted(si);
} else {
// ss occludes si2. Sadly, we can't remove it from the list.
- if (si->occl && si->occludes(*si2)) si2->occluded = true;
+ if (si->_occl && si->occludes(*si2)) si2->_occluded = true;
// si2 is behind si1, so add it to si1's dependency list
- else si->depends.push_back(si2);
+ else si->_depends.push_back(si2);
}
}
// Add it to the list
- items_unused = items_unused->next;
+ _itemsUnused = _itemsUnused->_next;
// have a position
//addpoint = 0;
if (addpoint) {
- si->next = addpoint;
- si->prev = addpoint->prev;
- addpoint->prev = si;
- if (si->prev) si->prev->next = si;
- else items = si;
+ si->_next = addpoint;
+ si->_prev = addpoint->_prev;
+ addpoint->_prev = si;
+ if (si->_prev) si->_prev->_next = si;
+ else _items = si;
}
// Add it to the end of the list
else {
- if (items_tail) items_tail->next = si;
- if (!items) items = si;
- si->next = 0;
- si->prev = items_tail;
- items_tail = si;
+ if (_itemsTail) _itemsTail->_next = si;
+ if (!_items) _items = si;
+ si->_next = 0;
+ si->_prev = _itemsTail;
+ _itemsTail = si;
}
}
@@ -822,19 +821,19 @@ void ItemSorter::AddItem(Item *add) {
#else
//if (add->iz > skip_lift) return;
- //if (Application::tgwds && shape == 538) return;
+ //if (Application::tgwds && _shape == 538) return;
// First thing, get a SortItem to use
- if (!items_unused) items_unused = new SortItem(0);
- SortItem *si = items_unused;
-
- si->item_num = add->getObjId();
- si->shape = add->getShapeObject();
- si->shape_num = add->getShape();
- si->frame = add->getFrame();
- ShapeFrame *frame = si->shape->getFrame(si->frame);
- if (!frame) {
- perr << "Invalid shape: " << si->shape_num << "," << si->frame
+ if (!_itemsUnused) _itemsUnused = new SortItem(0);
+ SortItem *si = _itemsUnused;
+
+ si->_itemNum = add->getObjId();
+ si->_shape = add->getShapeObject();
+ si->_shapeNum = add->getShape();
+ si->_frame = add->getFrame();
+ ShapeFrame *_frame = si->_shape->getFrame(si->_frame);
+ if (!_frame) {
+ perr << "Invalid _shape: " << si->_shapeNum << "," << si->_frame
<< Std::endl;
return;
}
@@ -846,11 +845,11 @@ void ItemSorter::AddItem(Item *add) {
// Dimensions
int32 xd, yd, zd;
- si->flags = add->getFlags();
- si->ext_flags = add->getExtFlags();
+ si->_flags = add->getFlags();
+ si->_extFlags = add->getExtFlags();
// X and Y are flipped
- if (si->flags & Item::FLG_FLIPPED) {
+ if (si->_flags & Item::FLG_FLIPPED) {
xd = info->_y * 32; // Multiply by 32 to get actual world size
yd = info->_x * 32; // Multiply by 32 to get actual world size
} else {
@@ -861,161 +860,161 @@ void ItemSorter::AddItem(Item *add) {
zd = info->_z * 8; // Multiply by 8 to get actual world size
// Worldspace bounding box
- add->getLerped(si->x, si->y, si->z);
- si->xleft = si->x - xd;
- si->yfar = si->y - yd;
- si->ztop = si->z + zd;
+ add->getLerped(si->_x, si->_y, si->_z);
+ si->_xLeft = si->_x - xd;
+ si->_yFar = si->_y - yd;
+ si->_zTop = si->_z + zd;
// Screenspace bounding box left extent (LNT x coord)
- si->sxleft = si->xleft / 4 - si->y / 4 - cam_sx;
+ si->_sxLeft = si->_xLeft / 4 - si->_y / 4 - _camSx;
// Screenspace bounding box right extent (RFT x coord)
- si->sxright = si->x / 4 - si->yfar / 4 - cam_sx;
+ si->_sxRight = si->_x / 4 - si->_yFar / 4 - _camSx;
// Screenspace bounding box top x coord (LFT x coord)
- si->sxtop = si->xleft / 4 - si->yfar / 4 - cam_sx;
+ si->_sxTop = si->_xLeft / 4 - si->_yFar / 4 - _camSx;
// Screenspace bounding box top extent (LFT y coord)
- si->sytop = si->xleft / 8 + si->yfar / 8 - si->ztop - cam_sy;
+ si->_syTop = si->_xLeft / 8 + si->_yFar / 8 - si->_zTop - _camSy;
// Screenspace bounding box bottom x coord (RNB x coord)
- si->sxbot = si->x / 4 - si->y / 4 - cam_sx;
+ si->_sxBot = si->_x / 4 - si->_y / 4 - _camSx;
// Screenspace bounding box bottom extent (RNB y coord)
- si->sybot = si->x / 8 + si->y / 8 - si->z - cam_sy;
+ si->_syBot = si->_x / 8 + si->_y / 8 - si->_z - _camSy;
-// si->sxleft += swo2;
-// si->sxright += swo2;
-// si->sxbot += swo2;
-// si->sxtop += swo2;
+// si->_sxLeft += swo2;
+// si->_sxRight += swo2;
+// si->_sxBot += swo2;
+// si->_sxTop += swo2;
-// si->sytop += sho2;
-// si->sybot += sho2;
+// si->_syTop += sho2;
+// si->_syBot += sho2;
// Real Screenspace coords
- si->sx = si->sxbot - frame->_xoff; // Left
- si->sy = si->sybot - frame->_yoff; // Top
- si->sx2 = si->sx + frame->_width; // Right
- si->sy2 = si->sy + frame->_height; // Bottom
+ si->sx = si->_sxBot - _frame->_xoff; // Left
+ si->sy = si->_syBot - _frame->_yoff; // Top
+ si->sx2 = si->sx + _frame->_width; // Right
+ si->sy2 = si->sy + _frame->_height; // Bottom
// Do Clipping here
- si->clipped = surf->CheckClipped(Rect(si->sx, si->sy, frame->_width, frame->_height));
- if (si->clipped < 0) return;
+ si->_clipped = _surf->CheckClipped(Rect(si->sx, si->sy, _frame->_width, _frame->_height));
+ if (si->_clipped < 0) return;
// These help out with sorting. We calc them now, so it will be faster
- si->f32x32 = xd == 128 && yd == 128;
- si->flat = zd == 0;
+ si->_f32x32 = xd == 128 && yd == 128;
+ si->_flat = zd == 0;
/*
if (Application::tgwds) {
- si->draw = false;
- si->solid = false;
- si->occl = false;
+ si->_draw = false;
+ si->_solid = false;
+ si->_occl = false;
si->roof = false;
si->noisy = false;
- si->anim = false;
- si->trans = false;
+ si->_anim = false;
+ si->_trans = false;
}
else
*/
{
- si->draw = info->is_draw();
- si->solid = info->is_solid();
- si->occl = info->is_occl() && !(si->flags & Item::FLG_INVISIBLE) &&
- !(si->ext_flags & Item::EXT_TRANSPARENT);
- si->roof = info->is_roof();
- si->noisy = info->is_noisy();
- si->anim = info->_animType != 0;
- si->trans = info->is_translucent();
- si->fixed = info->is_fixed();
- si->land = info->is_land();
+ si->_draw = info->is_draw();
+ si->_solid = info->is_solid();
+ si->_occl = info->is_occl() && !(si->_flags & Item::FLG_INVISIBLE) &&
+ !(si->_extFlags & Item::EXT_TRANSPARENT);
+ si->_roof = info->is_roof();
+ si->_noisy = info->is_noisy();
+ si->_anim = info->_animType != 0;
+ si->_trans = info->is_translucent();
+ si->_fixed = info->is_fixed();
+ si->_land = info->is_land();
}
- si->occluded = false;
- si->order = -1;
+ si->_occluded = false;
+ si->_order = -1;
// We will clear all the vector memory
// Stictly speaking the vector will sort of leak memory, since they
// are never deleted
- si->depends.clear();
- //si->depends.erase(si->depends.begin(), si->depends.end()); // MSVC.Netism
+ si->_depends.clear();
+ //si->_depends.erase(si->_depends.begin(), si->_depends.end()); // MSVC.Netism
- // Iterate the list and compare shapes
+ // Iterate the list and compare _shapes
// Ok,
SortItem *addpoint = 0;
- for (SortItem *si2 = items; si2 != 0; si2 = si2->next) {
+ for (SortItem *si2 = _items; si2 != 0; si2 = si2->_next) {
// Get the insert point... which is before the first item that has higher z than us
if (!addpoint && si->ListLessThan(si2)) addpoint = si2;
// Doesn't overlap
- if (si2->occluded || !si->overlap(*si2)) continue;
+ if (si2->_occluded || !si->overlap(*si2)) continue;
// Attempt to find which is infront
if (*si < *si2) {
// si2 occludes ss
- if (si2->occl && si2->occludes(*si)) {
+ if (si2->_occl && si2->occludes(*si)) {
// No need to do any more checks, this isn't visible
- si->occluded = true;
+ si->_occluded = true;
break;
}
// si1 is behind si2, so add it to si2's dependency list
- si2->depends.insert_sorted(si);
+ si2->_depends.insert_sorted(si);
} else {
// ss occludes si2. Sadly, we can't remove it from the list.
- if (si->occl && si->occludes(*si2)) si2->occluded = true;
+ if (si->_occl && si->occludes(*si2)) si2->_occluded = true;
// si2 is behind si1, so add it to si1's dependency list
- else si->depends.push_back(si2);
+ else si->_depends.push_back(si2);
}
}
// Add it to the list
- items_unused = items_unused->next;
+ _itemsUnused = _itemsUnused->_next;
// have a position
//addpoint = 0;
if (addpoint) {
- si->next = addpoint;
- si->prev = addpoint->prev;
- addpoint->prev = si;
- if (si->prev) si->prev->next = si;
- else items = si;
+ si->_next = addpoint;
+ si->_prev = addpoint->_prev;
+ addpoint->_prev = si;
+ if (si->_prev) si->_prev->_next = si;
+ else _items = si;
}
// Add it to the end of the list
else {
- if (items_tail) items_tail->next = si;
- if (!items) items = si;
- si->next = 0;
- si->prev = items_tail;
- items_tail = si;
+ if (_itemsTail) _itemsTail->_next = si;
+ if (!_items) _items = si;
+ si->_next = 0;
+ si->_prev = _itemsTail;
+ _itemsTail = si;
}
#endif
}
-SortItem *prev = 0;
+SortItem *_prev = 0;
void ItemSorter::PaintDisplayList(bool item_highlight) {
- prev = 0;
- SortItem *it = items;
+ _prev = 0;
+ SortItem *it = _items;
SortItem *end = 0;
- order_counter = 0; // Reset the order_counter
+ _orderCounter = 0; // Reset the _orderCounter
while (it != end) {
- if (it->order == -1) if (PaintSortItem(it)) return;
- it = it->next;
+ if (it->_order == -1) if (PaintSortItem(it)) return;
+ it = it->_next;
}
// Item highlighting. We redraw each 'item' transparent
if (item_highlight) {
- it = items;
+ it = _items;
while (it != end) {
- if (!(it->flags & (Item::FLG_DISPOSABLE | Item::FLG_FAST_ONLY)) && !it->fixed) {
- surf->PaintHighlightInvis(it->shape,
- it->frame,
- it->sxbot,
- it->sybot,
- it->trans,
- (it->flags & Item::FLG_FLIPPED) != 0, 0x1f00ffff);
+ if (!(it->_flags & (Item::FLG_DISPOSABLE | Item::FLG_FAST_ONLY)) && !it->_fixed) {
+ _surf->PaintHighlightInvis(it->_shape,
+ it->_frame,
+ it->_sxBot,
+ it->_syBot,
+ it->_trans,
+ (it->_flags & Item::FLG_FLIPPED) != 0, 0x1f00ffff);
}
- it = it->next;
+ it = it->_next;
}
}
@@ -1023,78 +1022,78 @@ void ItemSorter::PaintDisplayList(bool item_highlight) {
bool ItemSorter::PaintSortItem(SortItem *si) {
// Don't paint this, or dependencies if occluded
- if (si->occluded) return false;
+ if (si->_occluded) return false;
// Resursion, detection
- si->order = -2;
+ si->_order = -2;
// Iterate through our dependancies, and paint them, if possible
- SortItem::DependsList::iterator it = si->depends.begin();
- SortItem::DependsList::iterator end = si->depends.end();
+ SortItem::DependsList::iterator it = si->_depends.begin();
+ SortItem::DependsList::iterator end = si->_depends.end();
while (it != end) {
// Well, it can't. Implies infinite recursive sorting.
- //if ((*it)->order == -2) CANT_HAPPEN_MSG("Detected cycle in the dependency graph");
+ //if ((*it)->_order == -2) CANT_HAPPEN_MSG("Detected cycle in the dependency graph");
- if ((*it)->order == -1) if (PaintSortItem((*it))) return true;
+ if ((*it)->_order == -1) if (PaintSortItem((*it))) return true;
++it;
}
- // Set our painting order
- si->order = order_counter;
- order_counter++;
+ // Set our painting _order
+ si->_order = _orderCounter;
+ _orderCounter++;
// Now paint us!
// if (wire) si->info->draw_box_back(s, dispx, dispy, 255);
- if (si->ext_flags & Item::EXT_HIGHLIGHT && si->ext_flags & Item::EXT_TRANSPARENT)
- surf->PaintHighlightInvis(si->shape, si->frame, si->sxbot, si->sybot, si->trans, (si->flags & Item::FLG_FLIPPED) != 0, 0x7F00007F);
- if (si->ext_flags & Item::EXT_HIGHLIGHT)
- surf->PaintHighlight(si->shape, si->frame, si->sxbot, si->sybot, si->trans, (si->flags & Item::FLG_FLIPPED) != 0, 0x7F00007F);
- else if (si->ext_flags & Item::EXT_TRANSPARENT)
- surf->PaintInvisible(si->shape, si->frame, si->sxbot, si->sybot, si->trans, (si->flags & Item::FLG_FLIPPED) != 0);
- else if (si->flags & Item::FLG_FLIPPED)
- surf->PaintMirrored(si->shape, si->frame, si->sxbot, si->sybot, si->trans);
- else if (si->trans)
- surf->PaintTranslucent(si->shape, si->frame, si->sxbot, si->sybot);
- else if (!si->clipped)
- surf->PaintNoClip(si->shape, si->frame, si->sxbot, si->sybot);
+ if (si->_extFlags & Item::EXT_HIGHLIGHT && si->_extFlags & Item::EXT_TRANSPARENT)
+ _surf->PaintHighlightInvis(si->_shape, si->_frame, si->_sxBot, si->_syBot, si->_trans, (si->_flags & Item::FLG_FLIPPED) != 0, 0x7F00007F);
+ if (si->_extFlags & Item::EXT_HIGHLIGHT)
+ _surf->PaintHighlight(si->_shape, si->_frame, si->_sxBot, si->_syBot, si->_trans, (si->_flags & Item::FLG_FLIPPED) != 0, 0x7F00007F);
+ else if (si->_extFlags & Item::EXT_TRANSPARENT)
+ _surf->PaintInvisible(si->_shape, si->_frame, si->_sxBot, si->_syBot, si->_trans, (si->_flags & Item::FLG_FLIPPED) != 0);
+ else if (si->_flags & Item::FLG_FLIPPED)
+ _surf->PaintMirrored(si->_shape, si->_frame, si->_sxBot, si->_syBot, si->_trans);
+ else if (si->_trans)
+ _surf->PaintTranslucent(si->_shape, si->_frame, si->_sxBot, si->_syBot);
+ else if (!si->_clipped)
+ _surf->PaintNoClip(si->_shape, si->_frame, si->_sxBot, si->_syBot);
else
- surf->Paint(si->shape, si->frame, si->sxbot, si->sybot);
+ _surf->Paint(si->_shape, si->_frame, si->_sxBot, si->_syBot);
// if (wire) si->info->draw_box_front(s, dispx, dispy, 255);
// weapon overlay
// FIXME: use highlight/invisibility, also add to Trace() ?
- if (si->shape_num == 1 && si->item_num == 1) {
+ if (si->_shapeNum == 1 && si->_itemNum == 1) {
MainActor *av = getMainActor();
const WeaponOverlayFrame *wo_frame = 0;
uint32 wo_shapenum;
av->getWeaponOverlay(wo_frame, wo_shapenum);
if (wo_frame) {
Shape *wo_shape = GameData::get_instance()->getMainShapes()->getShape(wo_shapenum);
- surf->Paint(wo_shape, wo_frame->frame,
- si->sxbot + wo_frame->xoff,
- si->sybot + wo_frame->yoff);
+ _surf->Paint(wo_shape, wo_frame->_frame,
+ si->_sxBot + wo_frame->_xOff,
+ si->_syBot + wo_frame->_yOff);
}
}
- if (sort_limit) {
- if (order_counter == sort_limit) {
+ if (_sortLimit) {
+ if (_orderCounter == _sortLimit) {
static uint32 previt = 0;
- int x1 = si->xleft;
- int y1 = si->yfar;
- int z2 = si->ztop;
- if (!previt || previt != si->item_num) {
- previt = si->item_num;
- pout << si->shape_num << ":" << si->frame << " (" << x1 << "," << y1 << "," << si->z << ") (" << si->x << "," << si->y << "," << z2 << ")" << Std::endl;
+ int x1 = si->_xLeft;
+ int y1 = si->_yFar;
+ int z2 = si->_zTop;
+ if (!previt || previt != si->_itemNum) {
+ previt = si->_itemNum;
+ pout << si->_shapeNum << ":" << si->_frame << " (" << x1 << "," << y1 << "," << si->_z << ") (" << si->_x << "," << si->_y << "," << z2 << ")" << Std::endl;
// ss->info->print();
- if (prev) *prev << *si;
+ if (_prev) *_prev << *si;
}
return true;
}
- prev = si;
+ _prev = si;
}
return false;
@@ -1102,27 +1101,27 @@ bool ItemSorter::PaintSortItem(SortItem *si) {
bool ItemSorter::NullPaintSortItem(SortItem *si) {
// Don't paint this, or dependencies if occluded
- if (si->occluded) return false;
+ if (si->_occluded) return false;
// Resursion, detection
- si->order = -2;
+ si->_order = -2;
// Iterate through our dependancies, and paint them, if possible
- SortItem::DependsList::iterator it = si->depends.begin();
- SortItem::DependsList::iterator end = si->depends.end();
+ SortItem::DependsList::iterator it = si->_depends.begin();
+ SortItem::DependsList::iterator end = si->_depends.end();
while (it != end) {
// Well, it can't. Implies recursive sorting. Can happen though so
// you had best leave this commented out
- //if ((*it)->order == -2) CANT_HAPPEN_MSG("Recursive item sorting");
+ //if ((*it)->_order == -2) CANT_HAPPEN_MSG("Recursive item sorting");
- if ((*it)->order == -1) if (NullPaintSortItem((*it))) return true;
+ if ((*it)->_order == -1) if (NullPaintSortItem((*it))) return true;
++it;
}
- // Set our painting/sorting order
- si->order = order_counter;
- order_counter++;
+ // Set our painting/sorting _order
+ si->_order = _orderCounter;
+ _orderCounter++;
return false;
}
@@ -1131,40 +1130,40 @@ uint16 ItemSorter::Trace(int32 x, int32 y, HitFace *face, bool item_highlight) {
SortItem *it;
SortItem *selected;
- if (!order_counter) { // If no order_counter we need to sort the items
- it = items;
- order_counter = 0; // Reset the order_counter
+ if (!_orderCounter) { // If no _orderCounter we need to sort the _items
+ it = _items;
+ _orderCounter = 0; // Reset the _orderCounter
while (it != 0) {
- if (it->order == -1) if (NullPaintSortItem(it)) break;
+ if (it->_order == -1) if (NullPaintSortItem(it)) break;
- it = it->next;
+ it = it->_next;
}
}
- // Firstly, we check for highlighted items
+ // Firstly, we check for highlighted _items
selected = 0;
if (item_highlight) {
- it = items_tail;
+ it = _itemsTail;
selected = 0;
- for (it = items_tail; it != 0; it = it->prev) {
- if (!(it->flags & (Item::FLG_DISPOSABLE | Item::FLG_FAST_ONLY)) && !it->fixed) {
+ for (it = _itemsTail; it != 0; it = it->_prev) {
+ if (!(it->_flags & (Item::FLG_DISPOSABLE | Item::FLG_FAST_ONLY)) && !it->_fixed) {
- if (!it->item_num) continue;
+ if (!it->_itemNum) continue;
// Doesn't Overlap
if (x < it->sx || x >= it->sx2 || y < it->sy || y >= it->sy2) continue;
- // Now check the frame itself
- ShapeFrame *frame = it->shape->getFrame(it->frame);
- assert(frame); // invalid frames shouldn't have been added to the list
+ // Now check the _frame itself
+ ShapeFrame *_frame = it->_shape->getFrame(it->_frame);
+ assert(_frame); // invalid frames shouldn't have been added to the list
// Nope, doesn't have a point
- if (it->flags & Item::FLG_FLIPPED) {
- if (!frame->hasPoint(it->sxbot - x, y - it->sybot)) continue;
+ if (it->_flags & Item::FLG_FLIPPED) {
+ if (!_frame->hasPoint(it->_sxBot - x, y - it->_syBot)) continue;
} else {
- if (!frame->hasPoint(x - it->sxbot, y - it->sybot)) continue;
+ if (!_frame->hasPoint(x - it->_sxBot, y - it->_syBot)) continue;
}
// Ok now check against selected
@@ -1174,43 +1173,43 @@ uint16 ItemSorter::Trace(int32 x, int32 y, HitFace *face, bool item_highlight) {
}
- // Ok, this is all pretty simple. We iterate all the items.
+ // Ok, this is all pretty simple. We iterate all the _items.
// We then check to see if the item has a point where the trace goes.
- // Finally we then set the selected SortItem if it's 'order' is highest
+ // Finally we then set the selected SortItem if it's '_order' is highest
- if (!selected) for (it = items; it != 0; it = it->next) {
- if (!it->item_num) continue;
+ if (!selected) for (it = _items; it != 0; it = it->_next) {
+ if (!it->_itemNum) continue;
// Doesn't Overlap
if (x < it->sx || x >= it->sx2 || y < it->sy || y >= it->sy2) continue;
- // Now check the frame itself
- ShapeFrame *frame = it->shape->getFrame(it->frame);
- assert(frame); // invalid frames shouldn't have been added to the list
+ // Now check the _frame itself
+ ShapeFrame *_frame = it->_shape->getFrame(it->_frame);
+ assert(_frame); // invalid frames shouldn't have been added to the list
// Nope, doesn't have a point
- if (it->flags & Item::FLG_FLIPPED) {
- if (!frame->hasPoint(it->sxbot - x, y - it->sybot)) continue;
+ if (it->_flags & Item::FLG_FLIPPED) {
+ if (!_frame->hasPoint(it->_sxBot - x, y - it->_syBot)) continue;
} else {
- if (!frame->hasPoint(x - it->sxbot, y - it->sybot)) continue;
+ if (!_frame->hasPoint(x - it->_sxBot, y - it->_syBot)) continue;
}
// Ok now check against selected
- if (!selected || (it->order > selected->order)) selected = it;
+ if (!selected || (it->_order > selected->_order)) selected = it;
}
if (selected) {
if (face) {
- // shortcut for zero-height items
- if (selected->ztop == selected->z) {
+ // shortcut for zero-height _items
+ if (selected->_zTop == selected->_z) {
*face = Z_FACE;
} else {
// determine face that was hit
// RNT coordinates
- int32 RNTx = selected->sxbot;
- int32 RNTy = selected->sybot - selected->ztop + selected->z;
+ int32 RNTx = selected->_sxBot;
+ int32 RNTy = selected->_syBot - selected->_zTop + selected->_z;
/*
Bounding Box layout (top part)
@@ -1236,7 +1235,7 @@ uint16 ItemSorter::Trace(int32 x, int32 y, HitFace *face, bool item_highlight) {
}
}
- return selected->item_num;
+ return selected->_itemNum;
}
return 0;
diff --git a/engines/ultima/ultima8/world/item_sorter.h b/engines/ultima/ultima8/world/item_sorter.h
index 2565ce7..fdb6a70 100644
--- a/engines/ultima/ultima8/world/item_sorter.h
+++ b/engines/ultima/ultima8/world/item_sorter.h
@@ -32,17 +32,17 @@ class RenderSurface;
struct SortItem;
class ItemSorter {
- MainShapeArchive *shapes;
- RenderSurface *surf;
+ MainShapeArchive *_shapes;
+ RenderSurface *_surf;
- SortItem *items;
- SortItem *items_tail;
- SortItem *items_unused;
- int32 sort_limit;
+ SortItem *_items;
+ SortItem *_itemsTail;
+ SortItem *_itemsUnused;
+ int32 _sortLimit;
- int32 order_counter;
+ int32 _orderCounter;
- int32 cam_sx, cam_sy;
+ int32 _camSx, _camSy;
public:
ItemSorter();
@@ -66,10 +66,10 @@ public:
uint16 Trace(int32 x, int32 y, HitFace *face = 0, bool item_highlight = false);
void IncSortLimit() {
- sort_limit++;
+ _sortLimit++;
}
void DecSortLimit() {
- if (sort_limit > 0) sort_limit--;
+ if (_sortLimit > 0) _sortLimit--;
}
private:
Commit: 45d0d466753d62022eefc31143c46ea63bfb01cb
https://github.com/scummvm/scummvm/commit/45d0d466753d62022eefc31143c46ea63bfb01cb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-17T19:42:21-08:00
Commit Message:
ULTIMA8: Refactoring more world folder class fields
Changed paths:
engines/ultima/ultima8/usecode/intrinsics.h
engines/ultima/ultima8/world/current_map.cpp
engines/ultima/ultima8/world/item.cpp
engines/ultima/ultima8/world/item_sorter.cpp
engines/ultima/ultima8/world/map.cpp
engines/ultima/ultima8/world/map.h
engines/ultima/ultima8/world/missile_tracker.cpp
engines/ultima/ultima8/world/missile_tracker.h
engines/ultima/ultima8/world/split_item_process.cpp
engines/ultima/ultima8/world/split_item_process.h
engines/ultima/ultima8/world/sprite_process.cpp
engines/ultima/ultima8/world/sprite_process.h
engines/ultima/ultima8/world/world.cpp
engines/ultima/ultima8/world/world.h
engines/ultima/ultima8/world/world_point.h
diff --git a/engines/ultima/ultima8/usecode/intrinsics.h b/engines/ultima/ultima8/usecode/intrinsics.h
index 1941605..85fdc33 100644
--- a/engines/ultima/ultima8/usecode/intrinsics.h
+++ b/engines/ultima/ultima8/usecode/intrinsics.h
@@ -86,7 +86,7 @@ typedef uint32(*Intrinsic)(const uint8 *args, unsigned int argsize);
#define ARG_WORLDPOINT(x) ARG_UC_PTR(ucptr_##x); \
WorldPoint x; \
- UCMachine::get_instance()->dereferencePointer(ucptr_##x, x.buf, 5);
+ UCMachine::get_instance()->dereferencePointer(ucptr_##x, x._buf, 5);
#define ARG_NULL8() args+=1;
#define ARG_NULL16() args+=2;
diff --git a/engines/ultima/ultima8/world/current_map.cpp b/engines/ultima/ultima8/world/current_map.cpp
index ac3df73..9fb9395 100644
--- a/engines/ultima/ultima8/world/current_map.cpp
+++ b/engines/ultima/ultima8/world/current_map.cpp
@@ -108,7 +108,7 @@ uint32 CurrentMap::getNum() const {
if (_currentMap == 0)
return 0;
- return _currentMap->mapnum;
+ return _currentMap->_mapNum;
}
void CurrentMap::createEggHatcher() {
@@ -154,9 +154,9 @@ void CurrentMap::writeback() {
item->clearObjId();
if (item->getExtFlags() & Item::EXT_FIXED) {
// item came from fixed
- _currentMap->fixeditems.push_back(item);
+ _currentMap->_fixedItems.push_back(item);
} else {
- _currentMap->dynamicitems.push_back(item);
+ _currentMap->_dynamicItems.push_back(item);
}
}
_items[i][j].clear();
@@ -205,12 +205,12 @@ void CurrentMap::loadMap(Map *map) {
_fastXMax = -1;
_fastYMax = -1;
- loadItems(map->fixeditems, callCacheIn);
- loadItems(map->dynamicitems, callCacheIn);
+ loadItems(map->_fixedItems, callCacheIn);
+ loadItems(map->_dynamicItems, callCacheIn);
// we take control of the _items in map, so clear the pointers
- map->fixeditems.clear();
- map->dynamicitems.clear();
+ map->_fixedItems.clear();
+ map->_dynamicItems.clear();
// load relevant NPCs to the item lists
// !constant
diff --git a/engines/ultima/ultima8/world/item.cpp b/engines/ultima/ultima8/world/item.cpp
index 96d394a..2612be7 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -1892,7 +1892,7 @@ uint32 Item::I_getPoint(const uint8 *args, unsigned int /*argsize*/) {
point.setY(_y);
point.setZ(_z);
- UCMachine::get_instance()->assignPointer(ptr, point.buf, 5);
+ UCMachine::get_instance()->assignPointer(ptr, point._buf, 5);
return 0;
}
diff --git a/engines/ultima/ultima8/world/item_sorter.cpp b/engines/ultima/ultima8/world/item_sorter.cpp
index 4afec55..f44c033 100644
--- a/engines/ultima/ultima8/world/item_sorter.cpp
+++ b/engines/ultima/ultima8/world/item_sorter.cpp
@@ -55,8 +55,8 @@ struct SortItem {
uint32 _flags; // Item flags
uint32 _extFlags; // Item extended flags
- int sx, sx2; // Screenspace X coords
- int sy, sy2; // Screenspace Y coords
+ int _sx, _sx2; // Screenspace X coords
+ int _sy, _sy2; // Screenspace Y coords
/*
Bounding Box layout
@@ -712,13 +712,13 @@ void ItemSorter::AddItem(int32 x, int32 y, int32 z, uint32 _shapeNum, uint32 fra
// si->_syBot += sho2;
// Real Screenspace coords
- si->sx = si->_sxBot - _frame->_xoff; // Left
- si->sy = si->_syBot - _frame->_yoff; // Top
- si->sx2 = si->sx + _frame->_width; // Right
- si->sy2 = si->sy + _frame->_height; // Bottom
+ si->_sx = si->_sxBot - _frame->_xoff; // Left
+ si->_sy = si->_syBot - _frame->_yoff; // Top
+ si->_sx2 = si->_sx + _frame->_width; // Right
+ si->_sy2 = si->_sy + _frame->_height; // Bottom
// Do Clipping here
- si->_clipped = _surf->CheckClipped(Rect(si->sx, si->sy, _frame->_width, _frame->_height));
+ si->_clipped = _surf->CheckClipped(Rect(si->_sx, si->_sy, _frame->_width, _frame->_height));
if (si->_clipped < 0) return;
// These help out with sorting. We calc them now, so it will be faster
@@ -889,13 +889,13 @@ void ItemSorter::AddItem(Item *add) {
// si->_syBot += sho2;
// Real Screenspace coords
- si->sx = si->_sxBot - _frame->_xoff; // Left
- si->sy = si->_syBot - _frame->_yoff; // Top
- si->sx2 = si->sx + _frame->_width; // Right
- si->sy2 = si->sy + _frame->_height; // Bottom
+ si->_sx = si->_sxBot - _frame->_xoff; // Left
+ si->_sy = si->_syBot - _frame->_yoff; // Top
+ si->_sx2 = si->_sx + _frame->_width; // Right
+ si->_sy2 = si->_sy + _frame->_height; // Bottom
// Do Clipping here
- si->_clipped = _surf->CheckClipped(Rect(si->sx, si->sy, _frame->_width, _frame->_height));
+ si->_clipped = _surf->CheckClipped(Rect(si->_sx, si->_sy, _frame->_width, _frame->_height));
if (si->_clipped < 0) return;
// These help out with sorting. We calc them now, so it will be faster
@@ -1153,7 +1153,7 @@ uint16 ItemSorter::Trace(int32 x, int32 y, HitFace *face, bool item_highlight) {
if (!it->_itemNum) continue;
// Doesn't Overlap
- if (x < it->sx || x >= it->sx2 || y < it->sy || y >= it->sy2) continue;
+ if (x < it->_sx || x >= it->_sx2 || y < it->_sy || y >= it->_sy2) continue;
// Now check the _frame itself
ShapeFrame *_frame = it->_shape->getFrame(it->_frame);
@@ -1181,7 +1181,7 @@ uint16 ItemSorter::Trace(int32 x, int32 y, HitFace *face, bool item_highlight) {
if (!it->_itemNum) continue;
// Doesn't Overlap
- if (x < it->sx || x >= it->sx2 || y < it->sy || y >= it->sy2) continue;
+ if (x < it->_sx || x >= it->_sx2 || y < it->_sy || y >= it->_sy2) continue;
// Now check the _frame itself
ShapeFrame *_frame = it->_shape->getFrame(it->_frame);
diff --git a/engines/ultima/ultima8/world/map.cpp b/engines/ultima/ultima8/world/map.cpp
index 601ce67..c1e3500 100644
--- a/engines/ultima/ultima8/world/map.cpp
+++ b/engines/ultima/ultima8/world/map.cpp
@@ -30,7 +30,6 @@
#include "ultima/ultima8/kernel/object_manager.h"
#include "ultima/ultima8/kernel/core_app.h"
#include "ultima/ultima8/games/game_info.h"
-
#include "ultima/ultima8/graphics/shape_info.h" // debugging only
#include "ultima/ultima8/games/game_data.h"
#include "ultima/ultima8/graphics/main_shape_archive.h"
@@ -40,8 +39,8 @@ namespace Ultima8 {
//#define DUMP_ITEMS
-Map::Map(uint32 mapnum_)
- : mapnum(mapnum_) {
+Map::Map(uint32 mapNum)
+ : _mapNum(mapNum) {
}
@@ -53,19 +52,19 @@ Map::~Map() {
void Map::clear() {
Std::list<Item *>::iterator iter;
- for (iter = fixeditems.begin(); iter != fixeditems.end(); ++iter) {
+ for (iter = _fixedItems.begin(); iter != _fixedItems.end(); ++iter) {
delete *iter;
}
- fixeditems.clear();
+ _fixedItems.clear();
- for (iter = dynamicitems.begin(); iter != dynamicitems.end(); ++iter) {
+ for (iter = _dynamicItems.begin(); iter != _dynamicItems.end(); ++iter) {
delete *iter;
}
- dynamicitems.clear();
+ _dynamicItems.clear();
}
void Map::loadNonFixed(IDataSource *ds) {
- loadFixedFormatObjects(dynamicitems, ds, 0);
+ loadFixedFormatObjects(_dynamicItems, ds, 0);
}
@@ -82,167 +81,167 @@ static void shiftCoordsToZ(int32 &x, int32 &y, int32 &z, int32 newz) {
void Map::loadFixed(IDataSource *ds) {
- loadFixedFormatObjects(fixeditems, ds, Item::EXT_FIXED);
+ loadFixedFormatObjects(_fixedItems, ds, Item::EXT_FIXED);
// U8 hack for missing ground tiles on map 25. See docs/u8bugs.txt
- if (GAME_IS_U8 && mapnum == 25) {
+ if (GAME_IS_U8 && _mapNum == 25) {
// TODO
}
// U8 hack for missing ground/wall tiles on map 62. See docs/u8bugs.txt
- if (GAME_IS_U8 && mapnum == 62) {
+ if (GAME_IS_U8 && _mapNum == 62) {
Item *item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(16255, 6143, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(16639, 6143, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(16511, 6143, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(15999, 6143, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(15871, 6143, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(15743, 6143, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(15615, 6143, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(15999, 6015, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(15871, 6015, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(15743, 6015, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(15615, 6015, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(20095, 6911, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(20223, 6911, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(20095, 6783, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(20223, 6783, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(19839, 6655, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(19967, 6655, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(19839, 6527, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(19967, 6527, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(20095, 6527, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(19967, 6399, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(19839, 6399, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(301, 1, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(19711, 6399, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(497, 0, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(15487, 6271, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(497, 0, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(15359, 6271, 48);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(409, 32, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(14975, 6399, 0);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(409, 32, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(14975, 6015, 0);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
item = ItemFactory::createItem(409, 32, 0, 0, 0, 0,
Item::EXT_FIXED, false);
item->setLocation(15103, 6015, 0);
- fixeditems.push_back(item);
+ _fixedItems.push_back(item);
}
- if (GAME_IS_U8 && mapnum == 49) {
+ if (GAME_IS_U8 && _mapNum == 49) {
// Map 49 has some water tiles at the wrong z
Std::list<Item *>::iterator iter;
- for (iter = fixeditems.begin(); iter != fixeditems.end(); ++iter) {
+ for (iter = _fixedItems.begin(); iter != _fixedItems.end(); ++iter) {
if ((*iter)->getShape() == 347 && (*iter)->getZ() == 96) {
int32 x, y, z;
(*iter)->getLocation(x, y, z);
@@ -255,11 +254,11 @@ void Map::loadFixed(IDataSource *ds) {
}
}
- if (GAME_IS_U8 && mapnum == 21) {
+ if (GAME_IS_U8 && _mapNum == 21) {
// Map 21 has some ground and wall tiles at the wrong z
Std::list<Item *>::iterator iter;
- for (iter = fixeditems.begin(); iter != fixeditems.end(); ++iter) {
+ for (iter = _fixedItems.begin(); iter != _fixedItems.end(); ++iter) {
int32 z = (*iter)->getZ();
uint32 sh = (*iter)->getShape();
if (z == 8 && (sh == 301 || sh == 31 || sh == 32)) {
@@ -273,11 +272,11 @@ void Map::loadFixed(IDataSource *ds) {
}
}
- if (GAME_IS_U8 && mapnum == 5) {
+ if (GAME_IS_U8 && _mapNum == 5) {
// Map 5 has some ground tiles at the wrong z
Std::list<Item *>::iterator iter;
- for (iter = fixeditems.begin(); iter != fixeditems.end(); ++iter) {
+ for (iter = _fixedItems.begin(); iter != _fixedItems.end(); ++iter) {
if ((*iter)->getShape() == 71 && (*iter)->getFrame() == 8 && (*iter)->getZ() == 0) {
int32 x, y, z;
(*iter)->getLocation(x, y, z);
@@ -297,10 +296,10 @@ void Map::loadFixed(IDataSource *ds) {
void Map::unloadFixed() {
Std::list<Item *>::iterator iter;
- for (iter = fixeditems.begin(); iter != fixeditems.end(); ++iter) {
+ for (iter = _fixedItems.begin(); iter != _fixedItems.end(); ++iter) {
delete *iter;
}
- fixeditems.clear();
+ _fixedItems.clear();
}
void Map::loadFixedFormatObjects(Std::list<Item *> &itemlist, IDataSource *ds,
@@ -384,10 +383,10 @@ void Map::loadFixedFormatObjects(Std::list<Item *> &itemlist, IDataSource *ds,
void Map::save(ODataSource *ods) {
- ods->write4(static_cast<uint32>(dynamicitems.size()));
+ ods->write4(static_cast<uint32>(_dynamicItems.size()));
Std::list<Item *>::iterator iter;
- for (iter = dynamicitems.begin(); iter != dynamicitems.end(); ++iter) {
+ for (iter = _dynamicItems.begin(); iter != _dynamicItems.end(); ++iter) {
(*iter)->save(ods);
}
}
@@ -400,7 +399,7 @@ bool Map::load(IDataSource *ids, uint32 version) {
Object *obj = ObjectManager::get_instance()->loadObject(ids, version);
Item *item = p_dynamic_cast<Item *>(obj);
if (!item) return false;
- dynamicitems.push_back(item);
+ _dynamicItems.push_back(item);
}
return true;
diff --git a/engines/ultima/ultima8/world/map.h b/engines/ultima/ultima8/world/map.h
index a075eac..40820ba 100644
--- a/engines/ultima/ultima8/world/map.h
+++ b/engines/ultima/ultima8/world/map.h
@@ -44,8 +44,8 @@ public:
void loadFixed(IDataSource *ds);
void unloadFixed();
- bool isEmpty() {
- return fixeditems.size() == 0 && dynamicitems.size() == 0;
+ bool isEmpty() const {
+ return _fixedItems.size() == 0 && _dynamicItems.size() == 0;
}
void save(ODataSource *ods);
@@ -70,10 +70,10 @@ private:
// since fixed items will be cached out most of the time)
- Std::list<Item *> fixeditems;
- Std::list<Item *> dynamicitems;
+ Std::list<Item *> _fixedItems;
+ Std::list<Item *> _dynamicItems;
- uint32 mapnum;
+ uint32 _mapNum;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/missile_tracker.cpp b/engines/ultima/ultima8/world/missile_tracker.cpp
index 4ffc083..d24c532 100644
--- a/engines/ultima/ultima8/world/missile_tracker.cpp
+++ b/engines/ultima/ultima8/world/missile_tracker.cpp
@@ -35,11 +35,11 @@ namespace Ultima8 {
MissileTracker::MissileTracker(Item *item, int32 sx, int32 sy, int32 sz,
int32 tx, int32 ty, int32 tz,
int32 speed, int32 gravity_) {
- objid = item->getObjId();
- destx = tx;
- desty = ty;
- destz = tz;
- gravity = gravity_;
+ _objId = item->getObjId();
+ _destX = tx;
+ _destY = ty;
+ _destZ = tz;
+ _gravity = gravity_;
init(sx, sy, sz, speed);
}
@@ -48,11 +48,11 @@ MissileTracker::MissileTracker(Item *item, int32 tx, int32 ty, int32 tz,
int32 speed, int32 gravity_) {
assert(item->getParent() == 0);
- objid = item->getObjId();
- destx = tx;
- desty = ty;
- destz = tz;
- gravity = gravity_;
+ _objId = item->getObjId();
+ _destX = tx;
+ _destY = ty;
+ _destZ = tz;
+ _gravity = gravity_;
int32 x, y, z;
item->getLocation(x, y, z);
@@ -61,10 +61,10 @@ MissileTracker::MissileTracker(Item *item, int32 tx, int32 ty, int32 tz,
}
void MissileTracker::init(int32 x, int32 y, int32 z, int32 speed) {
- int range = ABS(x - destx) + ABS(y - desty);
+ int range = ABS(x - _destX) + ABS(y - _destY);
// rounded division: range/speed
- frames = (range + (speed / 2)) / speed;
+ _frames = (range + (speed / 2)) / speed;
/*
@@ -73,52 +73,52 @@ void MissileTracker::init(int32 x, int32 y, int32 z, int32 speed) {
z_{i+1} = z_i + s_i
s_{i+1} = s_i - g
- (z_i = vertical position after i frames,
- s_i = vertical speed after i frames, g = gravity)
+ (z_i = vertical position after i _frames,
+ s_i = vertical speed after i _frames, g = _gravity)
So:
z_i = z + sum_{j=0}^{i-1} ( s_0 - jg)
= z + is_0 - 1/2 i(i-1)g
- Conclusion: if we want to reach the destination vertical level in i frames,
+ Conclusion: if we want to reach the destination vertical level in i _frames,
we need to set
s_0 = ((1/2 gi(i-1)) + z_i-z) / i
*/
- if (frames > 0) {
- speedz = ((gravity * frames * (frames - 1) / 2) + destz - z) / frames;
+ if (_frames > 0) {
+ _speedZ = ((_gravity * _frames * (_frames - 1) / 2) + _destZ - z) / _frames;
// check if vertical speed isn't too high
- if (speedz > speed / 4) {
- if (gravity == 0 || (speed / (4 * gravity)) <= frames) {
- if (speed >= 4 && (destz - z) / (speed / 4) > frames)
- frames = (destz - z) / (speed / 4);
+ if (_speedZ > speed / 4) {
+ if (_gravity == 0 || (speed / (4 * _gravity)) <= _frames) {
+ if (speed >= 4 && (_destZ - z) / (speed / 4) > _frames)
+ _frames = (_destZ - z) / (speed / 4);
} else {
- frames = speed / (4 * gravity);
+ _frames = speed / (4 * _gravity);
}
}
- speedz = ((gravity * frames * (frames - 1) / 2) + destz - z) / frames;
+ _speedZ = ((_gravity * _frames * (_frames - 1) / 2) + _destZ - z) / _frames;
- // horizontal speed is easier: just divide distance by frames
- speedx = ((destx - x) + (frames / 2)) / frames;
- speedy = ((desty - y) + (frames / 2)) / frames;
+ // horizontal speed is easier: just divide distance by _frames
+ _speedX = ((_destX - x) + (_frames / 2)) / _frames;
+ _speedY = ((_destY - y) + (_frames / 2)) / _frames;
#if 0
- pout.printf("MissileTracker: from (%d,%d,%d) to (%d,%d,%d)\n", x, y, z, destx, desty, destz);
- pout.printf("speed: %d, gravity: %d, frames: %d\n", speed, gravity, frames);
- pout.printf("resulting speed: (%d,%d,%d)\n", speedx, speedy, speedz);
+ pout.printf("MissileTracker: from (%d,%d,%d) to (%d,%d,%d)\n", x, y, z, _destX, _destY, _destZ);
+ pout.printf("speed: %d, _gravity: %d, _frames: %d\n", speed, _gravity, _frames);
+ pout.printf("resulting speed: (%d,%d,%d)\n", _speedX, _speedY, _speedZ);
#endif
} else {
// no significant horizontal movement
- if (destz > z)
- speedz = speed / 4;
+ if (_destZ > z)
+ _speedZ = speed / 4;
else
- speedz = -speed / 4;
+ _speedZ = -speed / 4;
}
}
@@ -133,18 +133,18 @@ bool MissileTracker::isPathClear() {
int32 dims[3];
int32 sx, sy, sz;
- sx = speedx;
- sy = speedy;
- sz = speedz;
+ sx = _speedX;
+ sy = _speedY;
+ sz = _speedZ;
World *world = World::get_instance();
CurrentMap *map = world->getCurrentMap();
- Item *item = getItem(objid);
+ Item *item = getItem(_objId);
item->getFootpadWorld(dims[0], dims[1], dims[2]);
item->getLocation(start[0], start[1], start[2]);
- for (int f = 0; f < frames; ++f) {
+ for (int f = 0; f < _frames; ++f) {
end[0] = start[0] + sx;
end[1] = start[1] + sy;
end[2] = start[2] + sz;
@@ -152,7 +152,7 @@ bool MissileTracker::isPathClear() {
// Do the sweep test
Std::list<CurrentMap::SweepItem> collisions;
Std::list<CurrentMap::SweepItem>::iterator it;
- map->sweepTest(start, end, dims, item->getShapeInfo()->_flags, objid,
+ map->sweepTest(start, end, dims, item->getShapeInfo()->_flags, _objId,
false, &collisions);
int32 hit = 0x4000;
@@ -167,7 +167,7 @@ bool MissileTracker::isPathClear() {
return false;
}
- sz -= gravity;
+ sz -= _gravity;
for (int i = 0; i < 3; ++i) start[i] = end[i];
}
@@ -176,10 +176,10 @@ bool MissileTracker::isPathClear() {
void MissileTracker::launchItem() {
- Item *item = getItem(objid);
+ Item *item = getItem(_objId);
if (!item) return;
- item->hurl(speedx, speedy, speedz, gravity);
+ item->hurl(_speedX, _speedY, _speedZ, _gravity);
}
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/missile_tracker.h b/engines/ultima/ultima8/world/missile_tracker.h
index 1808d46..deac82e 100644
--- a/engines/ultima/ultima8/world/missile_tracker.h
+++ b/engines/ultima/ultima8/world/missile_tracker.h
@@ -45,11 +45,11 @@ protected:
void init(int32 sx, int32 sy, int32 sz, int32 speed);
private:
- ObjId objid;
- int32 destx, desty, destz;
- int32 speedx, speedy, speedz;
- int32 gravity;
- int frames;
+ ObjId _objId;
+ int32 _destX, _destY, _destZ;
+ int32 _speedX, _speedY, _speedZ;
+ int32 _gravity;
+ int _frames;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/split_item_process.cpp b/engines/ultima/ultima8/world/split_item_process.cpp
index 2ebde00..45704a9 100644
--- a/engines/ultima/ultima8/world/split_item_process.cpp
+++ b/engines/ultima/ultima8/world/split_item_process.cpp
@@ -21,12 +21,10 @@
*/
#include "ultima/ultima8/misc/pent_include.h"
-
#include "ultima/ultima8/world/split_item_process.h"
#include "ultima/ultima8/world/item.h"
#include "ultima/ultima8/graphics/shape_info.h"
#include "ultima/ultima8/world/get_object.h"
-
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/filesys/odata_source.h"
@@ -48,14 +46,14 @@ SplitItemProcess::SplitItemProcess(Item *original, Item *target_) {
assert(target_->getShapeInfo()->hasQuantity());
_itemNum = original->getObjId();
- target = target_->getObjId();
+ _target = target_->getObjId();
// type = TODO
}
void SplitItemProcess::run() {
Item *original = getItem(_itemNum);
- Item *targetitem = getItem(target);
+ Item *targetitem = getItem(_target);
assert(original);
assert(targetitem);
@@ -97,13 +95,13 @@ void SplitItemProcess::run() {
void SplitItemProcess::saveData(ODataSource *ods) {
Process::saveData(ods);
- ods->write2(target);
+ ods->write2(_target);
}
bool SplitItemProcess::loadData(IDataSource *ids, uint32 version) {
if (!Process::loadData(ids, version)) return false;
- target = ids->read2();
+ _target = ids->read2();
return true;
}
diff --git a/engines/ultima/ultima8/world/split_item_process.h b/engines/ultima/ultima8/world/split_item_process.h
index c6d1584..e9a5a4d 100644
--- a/engines/ultima/ultima8/world/split_item_process.h
+++ b/engines/ultima/ultima8/world/split_item_process.h
@@ -44,7 +44,7 @@ public:
protected:
void saveData(ODataSource *ods) override;
- ObjId target;
+ ObjId _target;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/sprite_process.cpp b/engines/ultima/ultima8/world/sprite_process.cpp
index 669e44a..4fd46d2 100644
--- a/engines/ultima/ultima8/world/sprite_process.cpp
+++ b/engines/ultima/ultima8/world/sprite_process.cpp
@@ -27,7 +27,6 @@
#include "ultima/ultima8/world/current_map.h"
#include "ultima/ultima8/kernel/kernel.h"
#include "ultima/ultima8/world/get_object.h"
-
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/filesys/odata_source.h"
@@ -43,21 +42,21 @@ SpriteProcess::SpriteProcess()
}
SpriteProcess::SpriteProcess(int Shape, int Frame, int LastFrame,
- int Repeats, int Delay, int X, int Y, int Z,
+ int Repeats, int Delay, int x, int y, int z,
bool delayed_init) :
- shape(Shape), frame(Frame), first_frame(Frame), last_frame(LastFrame),
- repeats(Repeats), delay(Delay * 2), x(X), y(Y), z(Z), delay_counter(0),
- initialized(false) {
+ _shape(Shape), _frame(Frame), _firstFrame(Frame), _lastFrame(LastFrame),
+ _repeats(Repeats), _delay(Delay * 2), _x(x), _y(y), _z(z), _delayCounter(0),
+ _initialized(false) {
if (!delayed_init)
init();
}
void SpriteProcess::init() {
- Item *item = ItemFactory::createItem(shape, frame,
- 0, Item::FLG_DISPOSABLE, 0, 0, Item::EXT_SPRITE, true);
- item->move(x, y, z);
+ Item *item = ItemFactory::createItem(_shape, _frame, 0, Item::FLG_DISPOSABLE,
+ 0, 0, Item::EXT_SPRITE, true);
+ item->move(_x, _y, _z);
setItemNum(item->getObjId());
- initialized = true;
+ _initialized = true;
}
SpriteProcess::~SpriteProcess(void) {
@@ -66,82 +65,82 @@ SpriteProcess::~SpriteProcess(void) {
}
void SpriteProcess::run() {
- if (!initialized) init();
+ if (!_initialized) init();
Item *item = getItem(_itemNum);
- if (!item || (frame > last_frame && repeats == 1 && !delay_counter)) {
+ if (!item || (_frame > _lastFrame && _repeats == 1 && !_delayCounter)) {
terminate();
return;
}
- if (delay_counter) {
- delay_counter = (delay_counter + 1) % delay;
+ if (_delayCounter) {
+ _delayCounter = (_delayCounter + 1) % _delay;
return;
}
- if (frame > last_frame) {
- frame = first_frame;
- repeats--;
+ if (_frame > _lastFrame) {
+ _frame = _firstFrame;
+ _repeats--;
}
- item->setFrame(frame);
- frame++;
- delay_counter = (delay_counter + 1) % delay;
+ item->setFrame(_frame);
+ _frame++;
+ _delayCounter = (_delayCounter + 1) % _delay;
}
-// createSprite(shape, frame, end, delay, x, y, z);
-// createSprite(shape, frame, end, unk, repeats, delay, x, y, z);
+// createSprite(_shape, _frame, end, _delay, _x, _y, _z);
+// createSprite(_shape, _frame, end, unk, _repeats, _delay, _x, _y, _z);
uint32 SpriteProcess::I_createSprite(const uint8 *args, unsigned int argsize) {
- int repeats = 1;
- ARG_SINT16(shape);
- ARG_SINT16(frame);
- ARG_SINT16(last_frame);
+ int _repeats = 1;
+ ARG_SINT16(_shape);
+ ARG_SINT16(_frame);
+ ARG_SINT16(_lastFrame);
if (argsize == 18) {
ARG_SINT16(unknown);
ARG_SINT16(repeats_count);
- repeats = repeats_count;
+ _repeats = repeats_count;
}
- ARG_SINT16(delay);
- ARG_UINT16(x);
- ARG_UINT16(y);
- ARG_UINT8(z);
- Process *p = new SpriteProcess(shape, frame, last_frame, repeats, delay, x, y, z);
+ ARG_SINT16(_delay);
+ ARG_UINT16(_x);
+ ARG_UINT16(_y);
+ ARG_UINT8(_z);
+ Process *p = new SpriteProcess(_shape, _frame, _lastFrame, _repeats, _delay, _x, _y, _z);
return Kernel::get_instance()->addProcess(p);
}
void SpriteProcess::saveData(ODataSource *ods) {
Process::saveData(ods);
- ods->write4(static_cast<uint32>(shape));
- ods->write4(static_cast<uint32>(frame));
- ods->write4(static_cast<uint32>(first_frame));
- ods->write4(static_cast<uint32>(last_frame));
- ods->write4(static_cast<uint32>(repeats));
- ods->write4(static_cast<uint32>(delay));
- ods->write4(static_cast<uint32>(x));
- ods->write4(static_cast<uint32>(y));
- ods->write4(static_cast<uint32>(z));
- ods->write4(static_cast<uint32>(delay_counter));
- ods->write1(initialized ? 1 : 0);
+ ods->write4(static_cast<uint32>(_shape));
+ ods->write4(static_cast<uint32>(_frame));
+ ods->write4(static_cast<uint32>(_firstFrame));
+ ods->write4(static_cast<uint32>(_lastFrame));
+ ods->write4(static_cast<uint32>(_repeats));
+ ods->write4(static_cast<uint32>(_delay));
+ ods->write4(static_cast<uint32>(_x));
+ ods->write4(static_cast<uint32>(_y));
+ ods->write4(static_cast<uint32>(_z));
+ ods->write4(static_cast<uint32>(_delayCounter));
+ ods->write1(_initialized ? 1 : 0);
}
bool SpriteProcess::loadData(IDataSource *ids, uint32 version) {
if (!Process::loadData(ids, version)) return false;
- shape = static_cast<int>(ids->read4());
- frame = static_cast<int>(ids->read4());
- first_frame = static_cast<int>(ids->read4());
- last_frame = static_cast<int>(ids->read4());
- repeats = static_cast<int>(ids->read4());
- delay = static_cast<int>(ids->read4());
- x = static_cast<int>(ids->read4());
- y = static_cast<int>(ids->read4());
- z = static_cast<int>(ids->read4());
- delay_counter = static_cast<int>(ids->read4());
- initialized = (ids->read1() != 0);
+ _shape = static_cast<int>(ids->read4());
+ _frame = static_cast<int>(ids->read4());
+ _firstFrame = static_cast<int>(ids->read4());
+ _lastFrame = static_cast<int>(ids->read4());
+ _repeats = static_cast<int>(ids->read4());
+ _delay = static_cast<int>(ids->read4());
+ _x = static_cast<int>(ids->read4());
+ _y = static_cast<int>(ids->read4());
+ _z = static_cast<int>(ids->read4());
+ _delayCounter = static_cast<int>(ids->read4());
+ _initialized = (ids->read1() != 0);
return true;
}
diff --git a/engines/ultima/ultima8/world/sprite_process.h b/engines/ultima/ultima8/world/sprite_process.h
index f785696..1d01950 100644
--- a/engines/ultima/ultima8/world/sprite_process.h
+++ b/engines/ultima/ultima8/world/sprite_process.h
@@ -31,15 +31,15 @@ namespace Ultima8 {
//! Creates a Sprite. Animates it. Destroys it.
class SpriteProcess : public Process {
- int shape;
- int frame;
- int first_frame;
- int last_frame;
- int repeats;
- int delay;
- int x, y, z;
- int delay_counter;
- bool initialized;
+ int _shape;
+ int _frame;
+ int _firstFrame;
+ int _lastFrame;
+ int _repeats;
+ int _delay;
+ int _x, _y, _z;
+ int _delayCounter;
+ bool _initialized;
public:
// p_dynamic_class stuff
ENABLE_RUNTIME_CLASSTYPE()
diff --git a/engines/ultima/ultima8/world/world.cpp b/engines/ultima/ultima8/world/world.cpp
index 16131b0..b89e62f 100644
--- a/engines/ultima/ultima8/world/world.cpp
+++ b/engines/ultima/ultima8/world/world.cpp
@@ -21,7 +21,6 @@
*/
#include "ultima/ultima8/misc/pent_include.h"
-
#include "ultima/ultima8/world/world.h"
#include "ultima/ultima8/world/map.h"
#include "ultima/ultima8/world/current_map.h"
@@ -49,13 +48,12 @@ namespace Ultima8 {
//#define DUMP_ITEMS
-World *World::world = 0;
+World *World::_world = 0;
-World::World()
- : currentmap(0) {
+World::World() : _currentMap(0) {
con->Print(MM_INFO, "Creating World...\n");
- world = this;
+ _world = this;
}
@@ -63,24 +61,24 @@ World::~World() {
con->Print(MM_INFO, "Destroying World...\n");
clear();
- world = 0;
+ _world = 0;
}
void World::clear() {
unsigned int i;
- for (i = 0; i < maps.size(); ++i) {
- delete maps[i];
+ for (i = 0; i < _maps.size(); ++i) {
+ delete _maps[i];
}
- maps.clear();
+ _maps.clear();
- while (!ethereal.empty())
- ethereal.pop_front();
+ while (!_ethereal.empty())
+ _ethereal.pop_front();
- if (currentmap)
- delete currentmap;
- currentmap = 0;
+ if (_currentMap)
+ delete _currentMap;
+ _currentMap = 0;
}
void World::reset() {
@@ -95,21 +93,21 @@ void World::initMaps() {
// Q: How do we determine which Maps to create? Only create those
// with non-zero size in fixed.dat?
- maps.resize(256);
+ _maps.resize(256);
for (unsigned int i = 0; i < 256; ++i) {
- maps[i] = new Map(i);
+ _maps[i] = new Map(i);
}
- currentmap = new CurrentMap();
+ _currentMap = new CurrentMap();
}
bool World::switchMap(uint32 newmap) {
- assert(currentmap);
+ assert(_currentMap);
- if (currentmap->getNum() == newmap)
+ if (_currentMap->getNum() == newmap)
return true;
- if (newmap >= maps.size() || maps[newmap] == 0)
+ if (newmap >= _maps.size() || _maps[newmap] == 0)
return false; // no such map
// Map switching procedure:
@@ -117,7 +115,7 @@ bool World::switchMap(uint32 newmap) {
// get rid of camera
// stop all sound effects (except speech, such as Guardian barks)
// notify all gumps of a map change
- // delete any ethereal objects
+ // delete any _ethereal objects
// write back CurrentMap to the old map, which
// deletes all disposable items
// deletes the EggHatcher
@@ -146,25 +144,25 @@ bool World::switchMap(uint32 newmap) {
if (desktop) desktop->CloseItemDependents();
}
- // get rid of any remaining ethereal items
- while (!ethereal.empty()) {
- uint16 eth = ethereal.front();
- ethereal.pop_front();
+ // get rid of any remaining _ethereal items
+ while (!_ethereal.empty()) {
+ uint16 eth = _ethereal.front();
+ _ethereal.pop_front();
Item *i = getItem(eth);
if (i) i->destroy();
}
- uint32 oldmap = currentmap->getNum();
+ uint32 oldmap = _currentMap->getNum();
if (oldmap != 0) {
perr << "Unloading map " << oldmap << Std::endl;
- assert(oldmap < maps.size() && maps[oldmap] != 0);
+ assert(oldmap < _maps.size() && _maps[oldmap] != 0);
- currentmap->writeback();
+ _currentMap->writeback();
perr << "Unloading Fixed items from map " << oldmap << Std::endl;
- maps[oldmap]->unloadFixed();
+ _maps[oldmap]->unloadFixed();
}
// Kill any processes that need killing (those with type != 1 && item != 0)
@@ -173,10 +171,10 @@ bool World::switchMap(uint32 newmap) {
pout << "Loading Fixed items in map " << newmap << Std::endl;
IDataSource *items = GameData::get_instance()->getFixed()
->get_datasource(newmap);
- maps[newmap]->loadFixed(items);
+ _maps[newmap]->loadFixed(items);
delete items;
- currentmap->loadMap(maps[newmap]);
+ _currentMap->loadMap(_maps[newmap]);
// reset camera
CameraProcess::SetCameraProcess(new CameraProcess(1));
@@ -196,12 +194,12 @@ void World::loadNonFixed(IDataSource *ds) {
// items in this map?
if (f->getSize(i) > 0) {
- assert(maps.size() > i);
- assert(maps[i] != 0);
+ assert(_maps.size() > i);
+ assert(_maps[i] != 0);
IDataSource *items = f->getDataSource(i);
- maps[i]->loadNonFixed(items);
+ _maps[i]->loadNonFixed(items);
delete items;
@@ -318,8 +316,8 @@ void World::loadItemCachNPCData(IDataSource *itemcach, IDataSource *npcdata) {
void World::worldStats() {
unsigned int i, mapcount = 0;
- for (i = 0; i < maps.size(); i++) {
- if (maps[i] != 0 && !maps[i]->isEmpty())
+ for (i = 0; i < _maps.size(); i++) {
+ if (_maps[i] != 0 && !_maps[i]->isEmpty())
mapcount++;
}
@@ -338,16 +336,16 @@ void World::worldStats() {
}
void World::save(ODataSource *ods) {
- ods->write4(currentmap->getNum());
+ ods->write4(_currentMap->getNum());
- ods->write2(currentmap->_eggHatcher);
+ ods->write2(_currentMap->_eggHatcher);
- uint16 es = static_cast<uint16>(ethereal.size());
+ uint16 es = static_cast<uint16>(_ethereal.size());
ods->write4(es);
// empty stack and refill it again
uint16 *e = new uint16[es];
- Std::list<ObjId>::iterator it = ethereal.begin();
+ Std::list<ObjId>::iterator it = _ethereal.begin();
unsigned int i;
for (i = 0; i < es; ++i) {
e[es - i] = *it;
@@ -363,22 +361,22 @@ void World::save(ODataSource *ods) {
// load items
bool World::load(IDataSource *ids, uint32 version) {
uint16 curmapnum = ids->read4();
- currentmap->setMap(maps[curmapnum]);
+ _currentMap->setMap(_maps[curmapnum]);
- currentmap->_eggHatcher = ids->read2();
+ _currentMap->_eggHatcher = ids->read2();
uint32 etherealcount = ids->read4();
for (unsigned int i = 0; i < etherealcount; ++i) {
- ethereal.push_front(ids->read2());
+ _ethereal.push_front(ids->read2());
}
return true;
}
void World::saveMaps(ODataSource *ods) {
- ods->write4(static_cast<uint32>(maps.size()));
- for (unsigned int i = 0; i < maps.size(); ++i) {
- maps[i]->save(ods);
+ ods->write4(static_cast<uint32>(_maps.size()));
+ for (unsigned int i = 0; i < _maps.size(); ++i) {
+ _maps[i]->save(ods);
}
}
@@ -388,7 +386,7 @@ bool World::loadMaps(IDataSource *ids, uint32 version) {
// Map objects have already been created by reset()
for (unsigned int i = 0; i < mapcount; ++i) {
- bool res = maps[i]->load(ids, version);
+ bool res = _maps[i]->load(ids, version);
if (!res) return false;
}
diff --git a/engines/ultima/ultima8/world/world.h b/engines/ultima/ultima8/world/world.h
index 2058b01..2e413d3 100644
--- a/engines/ultima/ultima8/world/world.h
+++ b/engines/ultima/ultima8/world/world.h
@@ -77,7 +77,7 @@ public:
~World();
static World *get_instance() {
- return world;
+ return _world;
}
//! clear the world (maps, currentmap, ethereal items)
@@ -97,7 +97,7 @@ public:
//! get the CurrentMap
CurrentMap *getCurrentMap() const {
- return currentmap;
+ return _currentMap;
}
//! switch map. This unloads the CurrentMap back into a Map, kills
@@ -107,22 +107,22 @@ public:
//! push an item onto the ethereal void
void etherealPush(ObjId objid) {
- ethereal.push_front(objid);
+ _ethereal.push_front(objid);
}
//! check if the the ethereal void is empty
bool etherealEmpty() {
- return ethereal.empty();
+ return _ethereal.empty();
}
//! return (but don't remove) the top item from the ethereal void
ObjId etherealPeek() {
- return ethereal.front();
+ return _ethereal.front();
}
//! remove an item from the ethereal void
void etherealRemove(ObjId objid) {
- ethereal.remove(objid);
+ _ethereal.remove(objid);
}
//! output some statistics about the world
@@ -141,12 +141,12 @@ public:
bool load(IDataSource *ids, uint32 version);
private:
- static World *world;
+ static World *_world;
- Std::vector<Map *> maps;
- CurrentMap *currentmap;
+ Std::vector<Map *> _maps;
+ CurrentMap *_currentMap;
- Std::list<ObjId> ethereal;
+ Std::list<ObjId> _ethereal;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/world_point.h b/engines/ultima/ultima8/world/world_point.h
index cc47f87..1cf0570 100644
--- a/engines/ultima/ultima8/world/world_point.h
+++ b/engines/ultima/ultima8/world/world_point.h
@@ -24,28 +24,28 @@
#define ULTIMA8_WORLD_WORLDPOINT_H
struct WorldPoint {
- uint8 buf[5];
+ uint8 _buf[5];
uint16 getX() const {
- return buf[0] + (buf[1] << 8);
+ return _buf[0] + (_buf[1] << 8);
}
uint16 getY() const {
- return buf[2] + (buf[3] << 8);
+ return _buf[2] + (_buf[3] << 8);
}
uint16 getZ() const {
- return buf[4];
+ return _buf[4];
}
void setX(int32 x) {
- buf[0] = static_cast<uint8>(x);
- buf[1] = static_cast<uint8>(x >> 8);
+ _buf[0] = static_cast<uint8>(x);
+ _buf[1] = static_cast<uint8>(x >> 8);
}
void setY(int32 y) {
- buf[2] = static_cast<uint8>(y);
- buf[3] = static_cast<uint8>(y >> 8);
+ _buf[2] = static_cast<uint8>(y);
+ _buf[3] = static_cast<uint8>(y >> 8);
}
void setZ(int32 z) {
- buf[4] = static_cast<uint8>(z);
+ _buf[4] = static_cast<uint8>(z);
}
};
Commit: e08bd88ce18c42c8da784c88617256cdd453b085
https://github.com/scummvm/scummvm/commit/e08bd88ce18c42c8da784c88617256cdd453b085
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-17T19:42:21-08:00
Commit Message:
ULTIMA8: Renaming actors folder class fields
Changed paths:
engines/ultima/ultima8/graphics/anim_dat.cpp
engines/ultima/ultima8/graphics/wpn_ovlay_dat.cpp
engines/ultima/ultima8/world/actors/actor.cpp
engines/ultima/ultima8/world/actors/actor.h
engines/ultima/ultima8/world/actors/actor_anim.h
engines/ultima/ultima8/world/actors/actor_anim_process.cpp
engines/ultima/ultima8/world/actors/anim_action.cpp
engines/ultima/ultima8/world/actors/anim_action.h
engines/ultima/ultima8/world/actors/animation_tracker.cpp
engines/ultima/ultima8/world/actors/animation_tracker.h
engines/ultima/ultima8/world/actors/main_actor.cpp
diff --git a/engines/ultima/ultima8/graphics/anim_dat.cpp b/engines/ultima/ultima8/graphics/anim_dat.cpp
index 880860c..ee83870 100644
--- a/engines/ultima/ultima8/graphics/anim_dat.cpp
+++ b/engines/ultima/ultima8/graphics/anim_dat.cpp
@@ -80,68 +80,68 @@ void AnimDat::load(IDataSource *ds) {
ActorAnim *a = new ActorAnim();
// CONSTANT !
- a->actions.resize(actioncount);
+ a->_actions.resize(actioncount);
for (unsigned int action = 0; action < actioncount; action++) {
ds->seek(offset + action * 4);
uint32 actionoffset = ds->read4();
if (actionoffset == 0) {
- a->actions[action] = 0;
+ a->_actions[action] = 0;
continue;
}
- a->actions[action] = new AnimAction();
+ a->_actions[action] = new AnimAction();
- a->actions[action]->shapenum = shape;
- a->actions[action]->action = action;
+ a->_actions[action]->_shapeNum = shape;
+ a->_actions[action]->_action = action;
ds->seek(actionoffset);
uint32 actionsize = ds->read1();
- a->actions[action]->size = actionsize;
- a->actions[action]->flags = ds->read1();
- a->actions[action]->framerepeat = ds->read1();
- a->actions[action]->flags |= ds->read1() << 8;
+ a->_actions[action]->_size = actionsize;
+ a->_actions[action]->_flags = ds->read1();
+ a->_actions[action]->_frameRepeat = ds->read1();
+ a->_actions[action]->_flags |= ds->read1() << 8;
- unsigned int dircount = 8;
+ unsigned int _dirCount = 8;
if (GAME_IS_CRUSADER &&
- (a->actions[action]->flags & AnimAction::AAF_CRUS_16DIRS)) {
- dircount = 16;
+ (a->_actions[action]->_flags & AnimAction::AAF_CRUS_16DIRS)) {
+ _dirCount = 16;
}
- a->actions[action]->dircount = dircount;
+ a->_actions[action]->_dirCount = _dirCount;
- for (unsigned int dir = 0; dir < dircount; dir++) {
- a->actions[action]->frames[dir].clear();
+ for (unsigned int dir = 0; dir < _dirCount; dir++) {
+ a->_actions[action]->frames[dir].clear();
for (unsigned int j = 0; j < actionsize; j++) {
if (GAME_IS_U8) {
- f.frame = ds->read1(); // & 0x7FF;
+ f._frame = ds->read1(); // & 0x7FF;
uint8 x = ds->read1();
- f.frame += (x & 0x7) << 8;
- f.deltaz = ds->readXS(1);
- f.sfx = ds->read1();
- f.deltadir = ds->readXS(1);
- f.flags = ds->read1();
- f.flags += (x & 0xF8) << 8;
+ f._frame += (x & 0x7) << 8;
+ f._deltaZ = ds->readXS(1);
+ f._sfx = ds->read1();
+ f._deltaDir = ds->readXS(1);
+ f._flags = ds->read1();
+ f._flags += (x & 0xF8) << 8;
} else if (GAME_IS_CRUSADER) {
// byte 0: low byte of frame
- f.frame = ds->read1();
+ f._frame = ds->read1();
// byte 1: low nibble part of frame
uint8 x = ds->read1();
- f.frame += (x & 0xF) << 8;
+ f._frame += (x & 0xF) << 8;
// byte 2, 3: unknown; byte 3 might contain flags
ds->skip(2);
// byte 4: deltadir (signed)
- f.deltadir = ds->readXS(1);
+ f._deltaDir = ds->readXS(1);
// byte 5: flags?
- f.flags = ds->read1();
+ f._flags = ds->read1();
// byte 6, 7: unknown
ds->skip(2);
- f.deltaz = 0;
- f.sfx = 0;
+ f._deltaZ = 0;
+ f._sfx = 0;
}
- a->actions[action]->frames[dir].push_back(f);
+ a->_actions[action]->frames[dir].push_back(f);
}
}
}
diff --git a/engines/ultima/ultima8/graphics/wpn_ovlay_dat.cpp b/engines/ultima/ultima8/graphics/wpn_ovlay_dat.cpp
index 6a02a17..f97130e 100644
--- a/engines/ultima/ultima8/graphics/wpn_ovlay_dat.cpp
+++ b/engines/ultima/ultima8/graphics/wpn_ovlay_dat.cpp
@@ -82,8 +82,8 @@ void WpnOvlayDat::load(RawArchive *overlaydat) {
AnimWeaponOverlay *awo = new AnimWeaponOverlay;
_overlay[action] = awo;
- unsigned int animlength = anim->size;
- unsigned int dircount = anim->dircount;
+ unsigned int animlength = anim->_size;
+ unsigned int dircount = anim->_dirCount;
unsigned int typecount = ds->getSize() / (4 * dircount * animlength);
awo->_overlay.resize(typecount);
diff --git a/engines/ultima/ultima8/world/actors/actor.cpp b/engines/ultima/ultima8/world/actors/actor.cpp
index fd0b65d..178312b 100644
--- a/engines/ultima/ultima8/world/actors/actor.cpp
+++ b/engines/ultima/ultima8/world/actors/actor.cpp
@@ -22,7 +22,6 @@
#include "ultima/ultima8/misc/pent_include.h"
#include "ultima/ultima8/world/actors/actor.h"
-
#include "ultima/ultima8/kernel/object_manager.h"
#include "ultima/ultima8/kernel/kernel.h"
#include "ultima/ultima8/usecode/uc_machine.h"
@@ -51,7 +50,6 @@
#include "ultima/ultima8/world/actors/main_actor.h"
#include "ultima/ultima8/audio/music_process.h"
#include "ultima/ultima8/world/get_object.h"
-
#include "ultima/ultima8/world/item_factory.h"
#include "ultima/ultima8/world/loop_script.h"
#include "ultima/ultima8/filesys/idata_source.h"
@@ -63,12 +61,10 @@ namespace Ultima8 {
// p_dynamic_cast stuff
DEFINE_RUNTIME_CLASSTYPE_CODE(Actor, Container)
-Actor::Actor()
- : strength(0), dexterity(0), intelligence(0),
- hitpoints(0), mana(0), alignment(0), enemyalignment(0),
- lastanim(Animation::walk), animframe(0), direction(0),
- fallstart(0), unk0C(0), actorflags(0) {
-
+Actor::Actor() : _strength(0), _dexterity(0), _intelligence(0),
+ _hitPoints(0), _mana(0), _alignment(0), _enemyAlignment(0),
+ _lastAnim(Animation::walk), _animFrame(0), _direction(0),
+ _fallStart(0), _unk0C(0), _actorFlags(0) {
}
Actor::~Actor() {
@@ -435,7 +431,7 @@ void Actor::teleport(int newmap, int32 newx, int32 newy, int32 newz) {
uint16 Actor::doAnim(Animation::Sequence anim, int dir, unsigned int steps) {
if (dir < 0 || dir > 8) {
- perr << "Actor::doAnim: Invalid direction (" << dir << ")" << Std::endl;
+ perr << "Actor::doAnim: Invalid _direction (" << dir << ")" << Std::endl;
return 0;
}
@@ -479,7 +475,7 @@ Animation::Result Actor::tryAnim(Animation::Sequence anim, int dir,
}
if (tracker.isBlocked() &&
- !(animaction->flags & AnimAction::AAF_UNSTOPPABLE)) {
+ !(animaction->_flags & AnimAction::AAF_UNSTOPPABLE)) {
return Animation::FAILURE;
}
@@ -601,7 +597,7 @@ void Actor::receiveHit(uint16 other, int dir, int damage, uint16 damage_type) {
}
if (other == 1 && attacker->getLastAnim() != Animation::kick) {
- // strength for kicks is accumulated in AvatarMoverProcess
+ // _strength for kicks is accumulated in AvatarMoverProcess
MainActor *av = getMainActor();
av->accumulateStr(damage / 4);
}
@@ -634,7 +630,7 @@ void Actor::receiveHit(uint16 other, int dir, int damage, uint16 damage_type) {
}
if (damage > 0 && !(getActorFlags() & (ACT_IMMORTAL | ACT_INVINCIBLE))) {
- if (damage >= hitpoints) {
+ if (damage >= _hitPoints) {
// we're dead
if (getActorFlags() & ACT_WITHSTANDDEATH) {
@@ -651,7 +647,7 @@ void Actor::receiveHit(uint16 other, int dir, int damage, uint16 damage_type) {
}
// not dead yet
- setHP(static_cast<uint16>(hitpoints - damage));
+ setHP(static_cast<uint16>(_hitPoints - damage));
}
ProcId fallingprocid = 0;
@@ -978,7 +974,7 @@ CombatProcess *Actor::getCombatProcess() {
}
void Actor::setInCombat() {
- if ((actorflags & ACT_INCOMBAT) != 0) return;
+ if ((_actorFlags & ACT_INCOMBAT) != 0) return;
assert(getCombatProcess() == 0);
@@ -999,7 +995,7 @@ void Actor::setInCombat() {
}
void Actor::clearInCombat() {
- if ((actorflags & ACT_INCOMBAT) == 0) return;
+ if ((_actorFlags & ACT_INCOMBAT) == 0) return;
CombatProcess *cp = getCombatProcess();
cp->terminate();
@@ -1070,47 +1066,47 @@ Actor *Actor::createActor(uint32 shape, uint32 frame) {
void Actor::dumpInfo() {
Container::dumpInfo();
- pout << "hp: " << hitpoints << ", mp: " << mana << ", str: " << strength
- << ", dex: " << dexterity << ", int: " << intelligence
+ pout << "hp: " << _hitPoints << ", mp: " << _mana << ", str: " << _strength
+ << ", dex: " << _dexterity << ", int: " << _intelligence
<< ", ac: " << getArmourClass() << ", defense: " << Std::hex
<< getDefenseType() << " align: " << getAlignment() << " enemy: "
- << getEnemyAlignment() << ", flags: " << actorflags
+ << getEnemyAlignment() << ", flags: " << _actorFlags
<< Std::dec << Std::endl;
}
void Actor::saveData(ODataSource *ods) {
Container::saveData(ods);
- ods->write2(strength);
- ods->write2(dexterity);
- ods->write2(intelligence);
- ods->write2(hitpoints);
- ods->write2(mana);
- ods->write2(alignment);
- ods->write2(enemyalignment);
- ods->write2(lastanim);
- ods->write2(animframe);
- ods->write2(direction);
- ods->write4(fallstart);
- ods->write4(actorflags);
- ods->write1(unk0C);
+ ods->write2(_strength);
+ ods->write2(_dexterity);
+ ods->write2(_intelligence);
+ ods->write2(_hitPoints);
+ ods->write2(_mana);
+ ods->write2(_alignment);
+ ods->write2(_enemyAlignment);
+ ods->write2(_lastAnim);
+ ods->write2(_animFrame);
+ ods->write2(_direction);
+ ods->write4(_fallStart);
+ ods->write4(_actorFlags);
+ ods->write1(_unk0C);
}
bool Actor::loadData(IDataSource *ids, uint32 version) {
if (!Container::loadData(ids, version)) return false;
- strength = static_cast<int16>(ids->read2());
- dexterity = static_cast<int16>(ids->read2());
- intelligence = static_cast<int16>(ids->read2());
- hitpoints = ids->read2();
- mana = static_cast<int16>(ids->read2());
- alignment = ids->read2();
- enemyalignment = ids->read2();
- lastanim = static_cast<Animation::Sequence>(ids->read2());
- animframe = ids->read2();
- direction = ids->read2();
- fallstart = ids->read4();
- actorflags = ids->read4();
- unk0C = ids->read1();
+ _strength = static_cast<int16>(ids->read2());
+ _dexterity = static_cast<int16>(ids->read2());
+ _intelligence = static_cast<int16>(ids->read2());
+ _hitPoints = ids->read2();
+ _mana = static_cast<int16>(ids->read2());
+ _alignment = ids->read2();
+ _enemyAlignment = ids->read2();
+ _lastAnim = static_cast<Animation::Sequence>(ids->read2());
+ _animFrame = ids->read2();
+ _direction = ids->read2();
+ _fallStart = ids->read4();
+ _actorFlags = ids->read4();
+ _unk0C = ids->read1();
return true;
}
diff --git a/engines/ultima/ultima8/world/actors/actor.h b/engines/ultima/ultima8/world/actors/actor.h
index c8eded5..d0ef215 100644
--- a/engines/ultima/ultima8/world/actors/actor.h
+++ b/engines/ultima/ultima8/world/actors/actor.h
@@ -42,45 +42,45 @@ public:
~Actor() override;
int16 getStr() const {
- return strength;
+ return _strength;
}
void setStr(int16 str) {
- strength = str;
+ _strength = str;
}
int16 getDex() const {
- return dexterity;
+ return _dexterity;
}
void setDex(int16 dex) {
- dexterity = dex;
+ _dexterity = dex;
}
int16 getInt() const {
- return intelligence;
+ return _intelligence;
}
- void setInt(int16 int_) {
- intelligence = int_;
+ void setInt(int16 intl) {
+ _intelligence = intl;
}
uint16 getHP() const {
- return hitpoints;
+ return _hitPoints;
}
void setHP(uint16 hp) {
- hitpoints = hp;
+ _hitPoints = hp;
}
int16 getMana() const {
- return mana;
+ return _mana;
}
void setMana(int16 mp) {
- mana = mp;
+ _mana = mp;
}
int16 getMaxMana() const;
uint16 getMaxHP() const;
bool isDead() const {
- return (actorflags & ACT_DEAD) != 0;
+ return (_actorFlags & ACT_DEAD) != 0;
}
bool isInCombat() const {
- return (actorflags & ACT_INCOMBAT) != 0;
+ return (_actorFlags & ACT_INCOMBAT) != 0;
}
void toggleInCombat() {
if (isInCombat()) clearInCombat();
@@ -92,51 +92,51 @@ public:
virtual void clearInCombat();
uint16 getAlignment() const {
- return alignment;
+ return _alignment;
}
void setAlignment(uint16 a) {
- alignment = a;
+ _alignment = a;
}
uint16 getEnemyAlignment() const {
- return enemyalignment;
+ return _enemyAlignment;
}
void setEnemyAlignment(uint16 a) {
- enemyalignment = a;
+ _enemyAlignment = a;
}
Animation::Sequence getLastAnim() const {
- return lastanim;
+ return _lastAnim;
}
void setLastAnim(Animation::Sequence anim) {
- lastanim = anim;
+ _lastAnim = anim;
}
uint16 getDir() const {
- return direction;
+ return _direction;
}
void setDir(uint16 dir) {
- direction = dir;
+ _direction = dir;
}
int32 getFallStart() const {
- return fallstart;
+ return _fallStart;
}
void setFallStart(int32 zp) {
- fallstart = zp;
+ _fallStart = zp;
}
void setUnk0C(uint8 b) {
- unk0C = b;
+ _unk0C = b;
}
uint32 getActorFlags() const {
- return actorflags;
+ return _actorFlags;
}
void setActorFlag(uint32 mask) {
- actorflags |= mask;
+ _actorFlags |= mask;
}
void clearActorFlag(uint32 mask) {
- actorflags &= ~mask;
+ _actorFlags &= ~mask;
}
- //! set stats from MonsterInfo (hp, dex, alignment, enemyalignment)
+ //! set stats from MonsterInfo (hp, dex, _alignment, _enemyAlignment)
//! \return true if a MonsterInfo struct was found, false otherwise
bool loadMonsterStats();
@@ -205,7 +205,7 @@ public:
//! state will be updated to after the animation. If unsuccessful,
//! the contents of state are undefined.
//! \param anim Action to try
- //! \param dir direction to walk in
+ //! \param dir _direction to walk in
//! \param state the state to start from, or 0 to use the current state
Animation::Result tryAnim(Animation::Sequence anim, int dir, unsigned int steps = 0, PathfindingState *state = 0);
@@ -294,22 +294,22 @@ public:
protected:
void saveData(ODataSource *ods) override;
- int16 strength;
- int16 dexterity;
- int16 intelligence;
- uint16 hitpoints;
- int16 mana;
+ int16 _strength;
+ int16 _dexterity;
+ int16 _intelligence;
+ uint16 _hitPoints;
+ int16 _mana;
- uint16 alignment, enemyalignment;
+ uint16 _alignment, _enemyAlignment;
- Animation::Sequence lastanim;
- uint16 animframe;
- uint16 direction;
+ Animation::Sequence _lastAnim;
+ uint16 _animFrame;
+ uint16 _direction;
- int32 fallstart;
- uint8 unk0C; // unknown byte 0x0C from npcdata.dat
+ int32 _fallStart;
+ uint8 _unk0C; // unknown byte 0x0C from npcdata.dat
- uint32 actorflags;
+ uint32 _actorFlags;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/actors/actor_anim.h b/engines/ultima/ultima8/world/actors/actor_anim.h
index d424b59..5ec31fe 100644
--- a/engines/ultima/ultima8/world/actors/actor_anim.h
+++ b/engines/ultima/ultima8/world/actors/actor_anim.h
@@ -34,17 +34,17 @@ class ActorAnim {
public:
ActorAnim() {}
~ActorAnim() {
- for (unsigned int i = 0; i < actions.size(); ++i)
- delete actions[i];
+ for (unsigned int i = 0; i < _actions.size(); ++i)
+ delete _actions[i];
}
AnimAction *getAction(unsigned int n) {
- if (n >= actions.size()) return 0;
- return actions[n];
+ if (n >= _actions.size()) return 0;
+ return _actions[n];
}
private:
- Std::vector<AnimAction *> actions; // list of this actor's actions
+ Std::vector<AnimAction *> _actions; // list of this actor's actions
// (0 if actor doesn't have action)
};
diff --git a/engines/ultima/ultima8/world/actors/actor_anim_process.cpp b/engines/ultima/ultima8/world/actors/actor_anim_process.cpp
index 44ec711..026a9ed 100644
--- a/engines/ultima/ultima8/world/actors/actor_anim_process.cpp
+++ b/engines/ultima/ultima8/world/actors/actor_anim_process.cpp
@@ -123,8 +123,8 @@ bool ActorAnimProcess::init() {
actor->setActorFlag(Actor::ACT_ANIMLOCK);
- actor->lastanim = _action;
- actor->direction = _dir;
+ actor->_lastAnim = _action;
+ actor->_direction = _dir;
#ifdef WATCHACTOR
@@ -157,7 +157,7 @@ void ActorAnimProcess::run() {
if (!_firstFrame)
_repeatCounter++;
- if (_repeatCounter > _tracker->getAnimAction()->framerepeat)
+ if (_repeatCounter > _tracker->getAnimAction()->_frameRepeat)
_repeatCounter = 0;
Actor *a = getActor(_itemNum);
@@ -230,7 +230,7 @@ void ActorAnimProcess::run() {
if (_tracker->isBlocked() &&
- !(_tracker->getAnimAction()->flags & AnimAction::AAF_UNSTOPPABLE)) {
+ !(_tracker->getAnimAction()->_flags & AnimAction::AAF_UNSTOPPABLE)) {
// FIXME: For blocked large _steps we may still want to do
// a partial move. (But how would that work with
// repeated frames?)
@@ -262,12 +262,12 @@ void ActorAnimProcess::run() {
}
AnimFrame *curframe = _tracker->getAnimFrame();
- if (curframe && curframe->sfx) {
+ if (curframe && curframe->_sfx) {
AudioProcess *audioproc = AudioProcess::get_instance();
- if (audioproc) audioproc->playSFX(curframe->sfx, 0x60, _itemNum, 0);
+ if (audioproc) audioproc->playSFX(curframe->_sfx, 0x60, _itemNum, 0);
}
- if (curframe && (curframe->flags & AnimFrame::AFF_SPECIAL)) {
+ if (curframe && (curframe->_flags & AnimFrame::AFF_SPECIAL)) {
// Flag to trigger a special _action
// E.g.: play draw/sheathe SFX for avatar when weapon equipped,
// throw skull-fireball when ghost attacks, ...
@@ -334,7 +334,7 @@ void ActorAnimProcess::run() {
#endif
- if (_repeatCounter == _tracker->getAnimAction()->framerepeat) {
+ if (_repeatCounter == _tracker->getAnimAction()->_frameRepeat) {
if (_tracker->isUnsupported()) {
_animAborted = true;
@@ -608,7 +608,7 @@ void ActorAnimProcess::terminate() {
if (a) {
if (_tracker) { // if we were really animating...
a->clearActorFlag(Actor::ACT_ANIMLOCK);
- if (_tracker->getAnimAction()->flags & AnimAction::AAF_DESTROYACTOR) {
+ if (_tracker->getAnimAction()->_flags & AnimAction::AAF_DESTROYACTOR) {
// destroy the actor
#ifdef WATCHACTOR
if (_itemNum == watchactor)
diff --git a/engines/ultima/ultima8/world/actors/anim_action.cpp b/engines/ultima/ultima8/world/actors/anim_action.cpp
index c0887ce..5da87bd 100644
--- a/engines/ultima/ultima8/world/actors/anim_action.cpp
+++ b/engines/ultima/ultima8/world/actors/anim_action.cpp
@@ -31,28 +31,28 @@ void AnimAction::getAnimRange(unsigned int lastanim, int lastdir,
bool firststep, int dir,
unsigned int &startframe, unsigned int &endframe) const {
startframe = 0;
- endframe = size;
+ endframe = _size;
- if (flags & AAF_TWOSTEP) {
+ if (_flags & AAF_TWOSTEP) {
// two-step animation?
if (firststep) {
- if (flags & (AAF_LOOPING | AAF_LOOPING2)) {// CHECKME: unknown flag
+ if (_flags & (AAF_LOOPING | AAF_LOOPING2)) {// CHECKME: unknown flag
// for a looping animation, start at the end to
// make things more fluid
- startframe = size - 1;
+ startframe = _size - 1;
} else {
startframe = 0;
}
- endframe = size / 2;
+ endframe = _size / 2;
} else {
// second step starts halfway
- startframe = size / 2;
- if (flags & (AAF_LOOPING | AAF_LOOPING2)) {// CHECKME: unknown flag
- endframe = size - 1;
+ startframe = _size / 2;
+ if (_flags & (AAF_LOOPING | AAF_LOOPING2)) {// CHECKME: unknown flag
+ endframe = _size - 1;
}
}
} else {
- if (lastanim == action && lastdir == dir && size > 1) {
+ if (lastanim == _action && lastdir == dir && _size > 1) {
// skip first frame if repeating an animation
startframe = 1;
}
diff --git a/engines/ultima/ultima8/world/actors/anim_action.h b/engines/ultima/ultima8/world/actors/anim_action.h
index 09f35e4..1771453 100644
--- a/engines/ultima/ultima8/world/actors/anim_action.h
+++ b/engines/ultima/ultima8/world/actors/anim_action.h
@@ -31,11 +31,11 @@ namespace Ultima8 {
class Actor;
struct AnimFrame {
- int frame;
- int deltaz;
- int deltadir;
- int sfx;
- uint32 flags;
+ int _frame;
+ int _deltaZ;
+ int _deltaDir;
+ int _sfx;
+ uint32 _flags;
enum AnimFrameFlags {
AFF_UNK1 = 0x0001,
@@ -45,23 +45,23 @@ struct AnimFrame {
};
inline bool is_flipped() {
- return (flags & AFF_FLIPPED) != 0;
+ return (_flags & AFF_FLIPPED) != 0;
}
inline int attack_range() {
- return ((flags >> 2) & 0x07);
+ return ((_flags >> 2) & 0x07);
}
};
struct AnimAction {
- uint32 shapenum;
- uint32 action;
+ uint32 _shapeNum;
+ uint32 _action;
Std::vector<AnimFrame> frames[16]; // 8 or 16 directions
- unsigned int size;
- int framerepeat;
- uint32 flags;
+ unsigned int _size;
+ int _frameRepeat;
+ uint32 _flags;
- unsigned int dircount;
+ unsigned int _dirCount;
//! return the range of the animation to play
//! \param actor The actor to play the animation for
diff --git a/engines/ultima/ultima8/world/actors/animation_tracker.cpp b/engines/ultima/ultima8/world/actors/animation_tracker.cpp
index fc982c7..46f21d6 100644
--- a/engines/ultima/ultima8/world/actors/animation_tracker.cpp
+++ b/engines/ultima/ultima8/world/actors/animation_tracker.cpp
@@ -22,7 +22,6 @@
#include "ultima/ultima8/misc/pent_include.h"
#include "ultima/ultima8/world/actors/animation_tracker.h"
-
#include "ultima/ultima8/games/game_data.h"
#include "ultima/ultima8/world/actors/actor.h"
#include "ultima/ultima8/world/world.h"
@@ -34,7 +33,6 @@
#include "ultima/ultima8/usecode/uc_list.h"
#include "ultima/ultima8/world/loop_script.h"
#include "ultima/ultima8/world/get_object.h"
-
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/filesys/odata_source.h"
#include "ultima/ultima8/kernel/core_app.h"
@@ -59,48 +57,48 @@ AnimationTracker::~AnimationTracker() {
bool AnimationTracker::init(Actor *actor_, Animation::Sequence action_,
uint32 dir_, PathfindingState *state_) {
assert(actor_);
- actor = actor_->getObjId();
+ _actor = actor_->getObjId();
uint32 shape = actor_->getShape();
- animaction = GameData::get_instance()->getMainShapes()->
+ _animAction = GameData::get_instance()->getMainShapes()->
getAnim(shape, action_);
- if (!animaction) return false;
+ if (!_animAction) return false;
- dir = dir_;
+ _dir = dir_;
if (state_ == 0) {
- animaction->getAnimRange(actor_, dir, startframe, endframe);
- actor_->getLocation(x, y, z);
- flipped = (actor_->getFlags() & Item::FLG_FLIPPED) != 0;
- firststep = (actor_->getActorFlags() & Actor::ACT_FIRSTSTEP) != 0;
+ _animAction->getAnimRange(actor_, _dir, _startFrame, _endFrame);
+ actor_->getLocation(_x, _y, _z);
+ _flipped = (actor_->getFlags() & Item::FLG_FLIPPED) != 0;
+ _firstStep = (actor_->getActorFlags() & Actor::ACT_FIRSTSTEP) != 0;
} else {
- animaction->getAnimRange(state_->lastanim, state_->direction,
- state_->firststep, dir, startframe, endframe);
- flipped = state_->flipped;
- firststep = state_->firststep;
- x = state_->x;
- y = state_->y;
- z = state_->z;
+ _animAction->getAnimRange(state_->lastanim, state_->direction,
+ state_->firststep, _dir, _startFrame, _endFrame);
+ _flipped = state_->flipped;
+ _firstStep = state_->firststep;
+ _x = state_->x;
+ _y = state_->y;
+ _z = state_->z;
}
- startx = x;
- starty = y;
- startz = z;
+ _startX = _x;
+ _startY = _y;
+ _startZ = _z;
#ifdef WATCHACTOR
if (actor_ && actor_->getObjId() == watchactor) {
- pout << "AnimationTracker: playing " << startframe << "-" << endframe
- << " (animaction flags: " << Std::hex << animaction->flags
+ pout << "AnimationTracker: playing " << _startFrame << "-" << _endFrame
+ << " (_animAction flags: " << Std::hex << _animAction->flags
<< Std::dec << ")" << Std::endl;
}
#endif
- firstframe = true;
+ _firstFrame = true;
- done = false;
- blocked = false;
- unsupported = false;
- hitobject = 0;
- mode = NormalMode;
+ _done = false;
+ _blocked = false;
+ _unsupported = false;
+ _hitObject = 0;
+ _mode = NormalMode;
return true;
}
@@ -108,12 +106,12 @@ bool AnimationTracker::init(Actor *actor_, Animation::Sequence action_,
unsigned int AnimationTracker::getNextFrame(unsigned int frame) {
frame++;
- if (frame == endframe)
- return endframe;
+ if (frame == _endFrame)
+ return _endFrame;
// loop if necessary
- if (frame >= animaction->size) {
- if (animaction->flags & (AnimAction::AAF_LOOPING |
+ if (frame >= _animAction->_size) {
+ if (_animAction->_flags & (AnimAction::AAF_LOOPING |
AnimAction::AAF_LOOPING2)) {
// CHECKME: unknown flag
frame = 1;
@@ -126,102 +124,102 @@ unsigned int AnimationTracker::getNextFrame(unsigned int frame) {
}
bool AnimationTracker::stepFrom(int32 x_, int32 y_, int32 z_) {
- x = x_;
- y = y_;
- z = z_;
+ _x = x_;
+ _y = y_;
+ _z = z_;
return step();
}
void AnimationTracker::evaluateMaxAnimTravel(int32 &max_endx, int32 &max_endy, uint32 dir_) {
- max_endx = x;
- max_endy = y;
+ max_endx = _x;
+ max_endy = _y;
- if (done) return;
+ if (_done) return;
- Actor *a = getActor(actor);
+ Actor *a = getActor(_actor);
assert(a);
unsigned int testframe;
- if (firstframe)
- testframe = startframe;
+ if (_firstFrame)
+ testframe = _startFrame;
else
- testframe = getNextFrame(currentframe);
+ testframe = getNextFrame(_currentFrame);
for (;;) {
- AnimFrame &f = animaction->frames[dir_][testframe];
+ AnimFrame &f = _animAction->frames[dir_][testframe];
// determine movement for this frame
- int32 dx = 4 * x_fact[dir_] * f.deltadir;
- int32 dy = 4 * y_fact[dir_] * f.deltadir;
+ int32 dx = 4 * x_fact[dir_] * f._deltaDir;
+ int32 dy = 4 * y_fact[dir_] * f._deltaDir;
max_endx += dx;
max_endy += dy;
testframe = getNextFrame(testframe);
- if (testframe == endframe)
+ if (testframe == _endFrame)
return;
}
}
bool AnimationTracker::step() {
- if (done) return false;
+ if (_done) return false;
- Actor *a = getActor(actor);
+ Actor *a = getActor(_actor);
assert(a);
- if (firstframe)
- currentframe = startframe;
+ if (_firstFrame)
+ _currentFrame = _startFrame;
else
- currentframe = getNextFrame(currentframe);
+ _currentFrame = getNextFrame(_currentFrame);
- if (currentframe == endframe) {
- done = true;
+ if (_currentFrame == _endFrame) {
+ _done = true;
// toggle ACT_FIRSTSTEP flag if necessary
- if (animaction->flags & AnimAction::AAF_TWOSTEP)
- firststep = !firststep;
+ if (_animAction->_flags & AnimAction::AAF_TWOSTEP)
+ _firstStep = !_firstStep;
else
- firststep = true;
+ _firstStep = true;
return false;
}
- prevx = x;
- prevy = y;
- prevz = z;
+ _prevX = _x;
+ _prevY = _y;
+ _prevZ = _z;
// reset status flags
- unsupported = false;
- blocked = false;
+ _unsupported = false;
+ _blocked = false;
- firstframe = false;
+ _firstFrame = false;
- AnimFrame &f = animaction->frames[dir][currentframe];
+ AnimFrame &f = _animAction->frames[_dir][_currentFrame];
- shapeframe = f.frame;
- flipped = f.is_flipped();
+ _shapeFrame = f._frame;
+ _flipped = f.is_flipped();
// determine movement for this frame
- int32 dx = 4 * x_fact[dir] * f.deltadir;
- int32 dy = 4 * y_fact[dir] * f.deltadir;
- int32 dz = f.deltaz;
+ int32 dx = 4 * x_fact[_dir] * f._deltaDir;
+ int32 dy = 4 * y_fact[_dir] * f._deltaDir;
+ int32 dz = f._deltaZ;
- if (mode == TargetMode && !(f.flags & AnimFrame::AFF_ONGROUND)) {
- dx += target_dx / target_offground_left;
- dy += target_dy / target_offground_left;
- dz += target_dz / target_offground_left;
+ if (_mode == TargetMode && !(f._flags & AnimFrame::AFF_ONGROUND)) {
+ dx += _targetDx / _targetOffGroundLeft;
+ dy += _targetDy / _targetOffGroundLeft;
+ dz += _targetDz / _targetOffGroundLeft;
- target_dx -= target_dx / target_offground_left;
- target_dy -= target_dy / target_offground_left;
- target_dz -= target_dz / target_offground_left;
+ _targetDx -= _targetDx / _targetOffGroundLeft;
+ _targetDy -= _targetDy / _targetOffGroundLeft;
+ _targetDz -= _targetDz / _targetOffGroundLeft;
- --target_offground_left;
+ --_targetOffGroundLeft;
}
// determine footpad
bool actorflipped = (a->getFlags() & Item::FLG_FLIPPED) != 0;
int32 xd, yd, zd;
a->getFootpadWorld(xd, yd, zd);
- if (actorflipped != flipped) {
+ if (actorflipped != _flipped) {
int32 t = xd;
xd = yd;
yd = t;
@@ -235,14 +233,14 @@ bool AnimationTracker::step() {
// - try to shift left/right a bit
// CHECKME: how often can we do these minor adjustments?
// CHECKME: for which animation types can we do them?
- // if still fails: blocked
+ // if still fails: _blocked
// * if ONGROUND
// - is supported if ONGROUND?
// if not:
// * try to step down a bit
// * try to shift left/right a bit
- // if still fails: unsupported
- // - if supported by non-land item: unsupported
+ // if still fails: _unsupported
+ // - if supported by non-land item: _unsupported
// It might be worth it creating a 'scanForValidPosition' function
// (in CurrentMap maybe) that scans a small area around the given
@@ -255,14 +253,14 @@ bool AnimationTracker::step() {
// scanForValidPosition after a teleport would work around that problem.
int32 tx, ty, tz;
- tx = x + dx;
- ty = y + dy;
- tz = z + dz;
+ tx = _x + dx;
+ ty = _y + dy;
+ tz = _z + dz;
// Only for particularly large steps we do a full sweepTest
if (ABS(dx) >= xd - 8 || ABS(dy) >= yd - 8 || ABS(dz) >= zd - 8) {
- int32 start[3] = { x, y, z };
+ int32 start[3] = { _x, _y, _z };
int32 end[3] = { tx, ty, tz };
int32 dims[3] = { xd, yd, zd };
@@ -282,11 +280,11 @@ bool AnimationTracker::step() {
<< "collision at time " << it->hit_time << Std::endl;
}
#endif
- blocked = true;
+ _blocked = true;
it->GetInterpolatedCoords(end, start, end);
- x = end[0];
- y = end[1];
- z = end[2];
+ _x = end[0];
+ _y = end[1];
+ _z = end[2];
return false;
}
}
@@ -296,10 +294,10 @@ bool AnimationTracker::step() {
Item *support;
bool targetok = cm->isValidPosition(tx, ty, tz,
- startx, starty, startz,
+ _startX, _startY, _startZ,
xd, yd, zd,
a->getShapeInfo()->_flags,
- actor, &support, 0);
+ _actor, &support, 0);
if (GAME_IS_U8 && targetok && support) {
// Might need to check for bridge traversal adjustments
@@ -332,31 +330,31 @@ bool AnimationTracker::step() {
}
}
- if (!targetok || ((f.flags & AnimFrame::AFF_ONGROUND) && !support)) {
+ if (!targetok || ((f._flags & AnimFrame::AFF_ONGROUND) && !support)) {
// If on ground, try to adjust properly
// TODO: Profile the effect of disabling this for pathfinding.
// It shouldn't be necessary in that case, and may provide a
// worthwhile speed-up.
- if ((f.flags & AnimFrame::AFF_ONGROUND) && zd > 8) {
- targetok = cm->scanForValidPosition(tx, ty, tz, a, dir,
+ if ((f._flags & AnimFrame::AFF_ONGROUND) && zd > 8) {
+ targetok = cm->scanForValidPosition(tx, ty, tz, a, _dir,
true, tx, ty, tz);
if (!targetok) {
- blocked = true;
+ _blocked = true;
return false;
} else {
#ifdef WATCHACTOR
if (a->getObjId() == watchactor) {
pout << "AnimationTracker: adjusted step: "
- << tx - (x + dx) << "," << ty - (y + dy) << "," << tz - (z + dz)
+ << tx - (_x + dx) << "," << ty - (_y + dy) << "," << tz - (_z + dz)
<< Std::endl;
}
#endif
}
} else {
if (!targetok) {
- blocked = true;
+ _blocked = true;
return false;
}
}
@@ -364,34 +362,34 @@ bool AnimationTracker::step() {
#ifdef WATCHACTOR
if (a->getObjId() == watchactor) {
- pout << "AnimationTracker: step (" << tx - x << "," << ty - y
- << "," << tz - z << ")" << Std::endl;
+ pout << "AnimationTracker: step (" << tx - _x << "," << ty - _y
+ << "," << tz - _z << ")" << Std::endl;
}
#endif
- x = tx;
- y = ty;
- z = tz;
+ _x = tx;
+ _y = ty;
+ _z = tz;
// if attack animation, see if we hit something
- if ((animaction->flags & AnimAction::AAF_ATTACK) &&
- (hitobject == 0) && f.attack_range() > 0) {
+ if ((_animAction->_flags & AnimAction::AAF_ATTACK) &&
+ (_hitObject == 0) && f.attack_range() > 0) {
checkWeaponHit();
}
- if (f.flags & AnimFrame::AFF_ONGROUND) {
+ if (f._flags & AnimFrame::AFF_ONGROUND) {
// needs support
/*bool targetok = */ cm->isValidPosition(tx, ty, tz,
- startx, starty, startz,
+ _startX, _startY, _startZ,
xd, yd, zd,
a->getShapeInfo()->_flags,
- actor, &support, 0);
+ _actor, &support, 0);
if (!support) {
- unsupported = true;
+ _unsupported = true;
return false;
} else {
#if 0
@@ -403,7 +401,7 @@ bool AnimationTracker::step() {
if (!supportitem->getShapeInfo()->is_land()) {
// pout << "Not land: "; supportitem->dumpInfo();
// invalid support
- unsupported = true;
+ _unsupported = true;
return false;
}
#endif
@@ -414,7 +412,7 @@ bool AnimationTracker::step() {
}
AnimFrame *AnimationTracker::getAnimFrame() {
- return &animaction->frames[dir][currentframe];
+ return &_animAction->frames[_dir][_currentFrame];
}
void AnimationTracker::setTargetedMode(int32 x_, int32 y_, int32 z_) {
@@ -424,50 +422,50 @@ void AnimationTracker::setTargetedMode(int32 x_, int32 y_, int32 z_) {
int offGround = 0;
int32 end_dx, end_dy, end_dz;
- for (i = startframe; i != endframe; i = getNextFrame(i)) {
- AnimFrame &f = animaction->frames[dir][i];
- totaldir += f.deltadir; // This line sometimes seg faults.. ????
- totalz += f.deltaz;
- if (!(f.flags & AnimFrame::AFF_ONGROUND))
+ for (i = _startFrame; i != _endFrame; i = getNextFrame(i)) {
+ AnimFrame &f = _animAction->frames[_dir][i];
+ totaldir += f._deltaDir; // This line sometimes seg faults.. ????
+ totalz += f._deltaZ;
+ if (!(f._flags & AnimFrame::AFF_ONGROUND))
++offGround;
}
- end_dx = 4 * x_fact[dir] * totaldir;
- end_dy = 4 * y_fact[dir] * totaldir;
+ end_dx = 4 * x_fact[_dir] * totaldir;
+ end_dy = 4 * y_fact[_dir] * totaldir;
end_dz = totalz;
if (offGround) {
- mode = TargetMode;
- target_offground_left = offGround;
- target_dx = x_ - x - end_dx;
- target_dy = y_ - y - end_dy;
- target_dz = z_ - z - end_dz;
+ _mode = TargetMode;
+ _targetOffGroundLeft = offGround;
+ _targetDx = x_ - _x - end_dx;
+ _targetDy = y_ - _y - end_dy;
+ _targetDz = z_ - _z - end_dz;
// Don't allow large changes in Z
- if (target_dz > 16)
- target_dz = 16;
- if (target_dz < -16)
- target_dz = -16;
+ if (_targetDz > 16)
+ _targetDz = 16;
+ if (_targetDz < -16)
+ _targetDz = -16;
}
}
void AnimationTracker::checkWeaponHit() {
- int range = animaction->frames[dir][currentframe].attack_range();
+ int range = _animAction->frames[_dir][_currentFrame].attack_range();
- Actor *a = getActor(actor);
+ Actor *a = getActor(_actor);
assert(a);
Box abox = a->getWorldBox();
- abox.MoveAbs(x, y, z);
- abox.MoveRel(x_fact[dir] * 32 * range, y_fact[dir] * 32 * range, 0);
+ abox.MoveAbs(_x, _y, _z);
+ abox.MoveRel(x_fact[_dir] * 32 * range, y_fact[_dir] * 32 * range, 0);
#ifdef WATCHACTOR
if (a->getObjId() == watchactor) {
pout << "AnimationTracker: Checking hit, range " << range << ", box "
- << abox.x << "," << abox.y << "," << abox.z << "," << abox.xd
+ << abox._x << "," << abox._y << "," << abox._z << "," << abox.xd
<< "," << abox.yd << "," << abox.zd << ": ";
}
#endif
@@ -477,12 +475,12 @@ void AnimationTracker::checkWeaponHit() {
UCList itemlist(2);
LOOPSCRIPT(script, LS_TOKEN_END);
- cm->areaSearch(&itemlist, script, sizeof(script), 0, 320, false, x, y);
+ cm->areaSearch(&itemlist, script, sizeof(script), 0, 320, false, _x, _y);
ObjId hit = 0;
for (unsigned int i = 0; i < itemlist.getSize(); ++i) {
ObjId itemid = itemlist.getuint16(i);
- if (itemid == actor) continue; // don't want to hit self
+ if (itemid == _actor) continue; // don't want to hit self
Actor *item = getActor(itemid);
if (!item) continue;
@@ -507,170 +505,170 @@ void AnimationTracker::checkWeaponHit() {
}
#endif
- hitobject = hit;
+ _hitObject = hit;
}
void AnimationTracker::updateState(PathfindingState &state) {
- state.x = x;
- state.y = y;
- state.z = z;
- state.flipped = flipped;
- state.firststep = firststep;
+ state.x = _x;
+ state.y = _y;
+ state.z = _z;
+ state.flipped = _flipped;
+ state.firststep = _firstStep;
}
void AnimationTracker::updateActorFlags() {
- Actor *a = getActor(actor);
+ Actor *a = getActor(_actor);
assert(a);
- if (flipped)
+ if (_flipped)
a->setFlag(Item::FLG_FLIPPED);
else
a->clearFlag(Item::FLG_FLIPPED);
- if (firststep)
+ if (_firstStep)
a->setActorFlag(Actor::ACT_FIRSTSTEP);
else
a->clearActorFlag(Actor::ACT_FIRSTSTEP);
- if (animaction) {
- bool hanging = (animaction->flags & AnimAction::AAF_HANGING) != 0;
+ if (_animAction) {
+ bool hanging = (_animAction->_flags & AnimAction::AAF_HANGING) != 0;
if (hanging)
a->setFlag(Item::FLG_HANGING);
else
a->clearFlag(Item::FLG_HANGING);
}
- if (currentframe != endframe)
- a->animframe = currentframe;
+ if (_currentFrame != _endFrame)
+ a->_animFrame = _currentFrame;
}
void AnimationTracker::getInterpolatedPosition(int32 &x_, int32 &y_,
int32 &z_, int fc) {
- int32 dx = x - prevx;
- int32 dy = y - prevy;
- int32 dz = z - prevz;
+ int32 dx = _x - _prevX;
+ int32 dy = _y - _prevY;
+ int32 dz = _z - _prevZ;
- x_ = prevx + (dx * fc) / (animaction->framerepeat + 1);
- y_ = prevy + (dy * fc) / (animaction->framerepeat + 1);
- z_ = prevz + (dz * fc) / (animaction->framerepeat + 1);
+ x_ = _prevX + (dx * fc) / (_animAction->_frameRepeat + 1);
+ y_ = _prevY + (dy * fc) / (_animAction->_frameRepeat + 1);
+ z_ = _prevZ + (dz * fc) / (_animAction->_frameRepeat + 1);
}
void AnimationTracker::getSpeed(int32 &dx, int32 &dy, int32 &dz) {
- dx = x - prevx;
- dy = y - prevy;
- dz = z - prevz;
+ dx = _x - _prevX;
+ dy = _y - _prevY;
+ dz = _z - _prevZ;
}
void AnimationTracker::save(ODataSource *ods) {
- ods->write4(startframe);
- ods->write4(endframe);
- uint8 ff = firstframe ? 1 : 0;
+ ods->write4(_startFrame);
+ ods->write4(_endFrame);
+ uint8 ff = _firstFrame ? 1 : 0;
ods->write1(ff);
- ods->write4(currentframe);
+ ods->write4(_currentFrame);
- ods->write2(actor);
- ods->write1(static_cast<uint8>(dir));
+ ods->write2(_actor);
+ ods->write1(static_cast<uint8>(_dir));
- if (animaction) {
- ods->write4(animaction->shapenum);
- ods->write4(animaction->action);
+ if (_animAction) {
+ ods->write4(_animAction->_shapeNum);
+ ods->write4(_animAction->_action);
} else {
ods->write4(0);
ods->write4(0);
}
- ods->write4(static_cast<uint32>(prevx));
- ods->write4(static_cast<uint32>(prevy));
- ods->write4(static_cast<uint32>(prevz));
- ods->write4(static_cast<uint32>(x));
- ods->write4(static_cast<uint32>(y));
- ods->write4(static_cast<uint32>(z));
-
- ods->write2(static_cast<uint16>(mode));
- if (mode == TargetMode) {
- ods->write4(static_cast<uint32>(target_dx));
- ods->write4(static_cast<uint32>(target_dy));
- ods->write4(static_cast<uint32>(target_dz));
- ods->write4(static_cast<uint32>(target_offground_left));
+ ods->write4(static_cast<uint32>(_prevX));
+ ods->write4(static_cast<uint32>(_prevY));
+ ods->write4(static_cast<uint32>(_prevZ));
+ ods->write4(static_cast<uint32>(_x));
+ ods->write4(static_cast<uint32>(_y));
+ ods->write4(static_cast<uint32>(_z));
+
+ ods->write2(static_cast<uint16>(_mode));
+ if (_mode == TargetMode) {
+ ods->write4(static_cast<uint32>(_targetDx));
+ ods->write4(static_cast<uint32>(_targetDy));
+ ods->write4(static_cast<uint32>(_targetDz));
+ ods->write4(static_cast<uint32>(_targetOffGroundLeft));
}
- uint8 fs = firststep ? 1 : 0;
+ uint8 fs = _firstStep ? 1 : 0;
ods->write1(fs);
- uint8 fl = flipped ? 1 : 0;
+ uint8 fl = _flipped ? 1 : 0;
ods->write1(fl);
- ods->write4(shapeframe);
+ ods->write4(_shapeFrame);
- uint8 flag = done ? 1 : 0;
+ uint8 flag = _done ? 1 : 0;
ods->write1(flag);
- flag = blocked ? 1 : 0;
+ flag = _blocked ? 1 : 0;
ods->write1(flag);
- flag = unsupported ? 1 : 0;
+ flag = _unsupported ? 1 : 0;
ods->write1(flag);
- ods->write2(hitobject);
+ ods->write2(_hitObject);
}
bool AnimationTracker::load(IDataSource *ids, uint32 version) {
- startframe = ids->read4();
- endframe = ids->read4();
- firstframe = (ids->read1() != 0);
- currentframe = ids->read4();
+ _startFrame = ids->read4();
+ _endFrame = ids->read4();
+ _firstFrame = (ids->read1() != 0);
+ _currentFrame = ids->read4();
- actor = ids->read2();
- dir = ids->read1();
+ _actor = ids->read2();
+ _dir = ids->read1();
uint32 shapenum = ids->read4();
uint32 action = ids->read4();
if (shapenum == 0) {
- animaction = 0;
+ _animAction = 0;
} else {
- animaction = GameData::get_instance()->getMainShapes()->
+ _animAction = GameData::get_instance()->getMainShapes()->
getAnim(shapenum, action);
- assert(animaction);
+ assert(_animAction);
}
- prevx = ids->read4();
- prevy = ids->read4();
- prevz = ids->read4();
- x = ids->read4();
- y = ids->read4();
- z = ids->read4();
-
- mode = static_cast<Mode>(ids->read2());
- if (mode == TargetMode) {
- target_dx = ids->read4();
- target_dy = ids->read4();
+ _prevX = ids->read4();
+ _prevY = ids->read4();
+ _prevZ = ids->read4();
+ _x = ids->read4();
+ _y = ids->read4();
+ _z = ids->read4();
+
+ _mode = static_cast<Mode>(ids->read2());
+ if (_mode == TargetMode) {
+ _targetDx = ids->read4();
+ _targetDy = ids->read4();
if (version >= 5) {
- target_dz = ids->read4();
- target_offground_left = ids->read4();
+ _targetDz = ids->read4();
+ _targetOffGroundLeft = ids->read4();
} else {
- // Versions before 5 stored the only x,y adjustment
- // to be made per frame. This is less accurate and ignores z.
+ // Versions before 5 stored the only _x,_y adjustment
+ // to be made per frame. This is less accurate and ignores _z.
- target_offground_left = 0;
- unsigned int i = currentframe;
- if (!firstframe) i = getNextFrame(i);
+ _targetOffGroundLeft = 0;
+ unsigned int i = _currentFrame;
+ if (!_firstFrame) i = getNextFrame(i);
- for (; i != endframe; i = getNextFrame(i)) {
- AnimFrame &f = animaction->frames[dir][i];
- if (!(f.flags & AnimFrame::AFF_ONGROUND))
- ++target_offground_left;
+ for (; i != _endFrame; i = getNextFrame(i)) {
+ AnimFrame &f = _animAction->frames[_dir][i];
+ if (!(f._flags & AnimFrame::AFF_ONGROUND))
+ ++_targetOffGroundLeft;
}
- target_dx *= target_offground_left;
- target_dy *= target_offground_left;
- target_dz = 0;
+ _targetDx *= _targetOffGroundLeft;
+ _targetDy *= _targetOffGroundLeft;
+ _targetDz = 0;
}
}
- firststep = (ids->read1() != 0);
- flipped = (ids->read1() != 0);
- shapeframe = ids->read4();
+ _firstStep = (ids->read1() != 0);
+ _flipped = (ids->read1() != 0);
+ _shapeFrame = ids->read4();
- done = (ids->read1() != 0);
- blocked = (ids->read1() != 0);
- unsupported = (ids->read1() != 0);
- hitobject = ids->read2();
+ _done = (ids->read1() != 0);
+ _blocked = (ids->read1() != 0);
+ _unsupported = (ids->read1() != 0);
+ _hitObject = ids->read2();
return true;
}
diff --git a/engines/ultima/ultima8/world/actors/animation_tracker.h b/engines/ultima/ultima8/world/actors/animation_tracker.h
index 14a14b9..b0c033e 100644
--- a/engines/ultima/ultima8/world/actors/animation_tracker.h
+++ b/engines/ultima/ultima8/world/actors/animation_tracker.h
@@ -67,10 +67,10 @@ public:
void updateActorFlags();
//! get the current position
- void getPosition(int32 &x_, int32 &y_, int32 &z_) {
- x_ = x;
- y_ = y;
- z_ = z;
+ void getPosition(int32 &x, int32 &y, int32 &z) {
+ x = _x;
+ y = _y;
+ z = _z;
}
void getInterpolatedPosition(int32 &x_, int32 &y_, int32 &z_, int fc);
@@ -80,12 +80,12 @@ public:
//! get the current (shape)frame
uint32 getFrame() {
- return shapeframe;
+ return _shapeFrame;
}
//! get the current AnimAction
AnimAction *getAnimAction() {
- return animaction;
+ return _animAction;
}
//! get the current AnimFrame
@@ -94,16 +94,16 @@ public:
void setTargetedMode(int32 x_, int32 y_, int32 z_);
bool isDone() const {
- return done;
+ return _done;
}
bool isBlocked() const {
- return blocked;
+ return _blocked;
}
bool isUnsupported() const {
- return unsupported;
+ return _unsupported;
}
ObjId hitSomething() const {
- return hitobject;
+ return _hitObject;
}
bool load(IDataSource *ids, uint32 version);
@@ -118,31 +118,31 @@ private:
unsigned int getNextFrame(unsigned int frame);
void checkWeaponHit();
- unsigned int startframe, endframe;
- bool firstframe;
- unsigned int currentframe;
+ unsigned int _startFrame, _endFrame;
+ bool _firstFrame;
+ unsigned int _currentFrame;
- ObjId actor;
- unsigned int dir;
+ ObjId _actor;
+ unsigned int _dir;
- AnimAction *animaction;
+ AnimAction *_animAction;
// actor state
- int32 prevx, prevy, prevz;
- int32 x, y, z;
- int32 startx, starty, startz;
- int32 target_dx, target_dy, target_dz;
- int32 target_offground_left;
- bool firststep, flipped;
- uint32 shapeframe;
+ int32 _prevX, _prevY, _prevZ;
+ int32 _x, _y, _z;
+ int32 _startX, _startY, _startZ;
+ int32 _targetDx, _targetDy, _targetDz;
+ int32 _targetOffGroundLeft;
+ bool _firstStep, _flipped;
+ uint32 _shapeFrame;
// status flags
- bool done;
- bool blocked;
- bool unsupported;
- ObjId hitobject;
+ bool _done;
+ bool _blocked;
+ bool _unsupported;
+ ObjId _hitObject;
- Mode mode;
+ Mode _mode;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/actors/main_actor.cpp b/engines/ultima/ultima8/world/actors/main_actor.cpp
index 9fa2f51..2929414 100644
--- a/engines/ultima/ultima8/world/actors/main_actor.cpp
+++ b/engines/ultima/ultima8/world/actors/main_actor.cpp
@@ -463,43 +463,43 @@ void MainActor::ConCmd_heal(const Console::ArgvType &argv) {
void MainActor::accumulateStr(int n) {
// already max?
- if (strength == 25) return; //!! constant
+ if (_strength == 25) return; //!! constant
accumStr += n;
if (accumStr >= 650 || getRandom() % (650 - accumStr) == 0) { //!! constant
- strength++;
+ _strength++;
accumStr = 0;
AudioProcess *audioproc = AudioProcess::get_instance();
if (audioproc) audioproc->playSFX(0x36, 0x60, 1, 0); //constants!!
- pout << "Gained strength!" << Std::endl;
+ pout << "Gained _strength!" << Std::endl;
}
}
void MainActor::accumulateDex(int n) {
// already max?
- if (dexterity == 25) return; //!! constant
+ if (_dexterity == 25) return; //!! constant
accumDex += n;
if (accumDex >= 650 || getRandom() % (650 - accumDex) == 0) { //!! constant
- dexterity++;
+ _dexterity++;
accumDex = 0;
AudioProcess *audioproc = AudioProcess::get_instance();
if (audioproc) audioproc->playSFX(0x36, 0x60, 1, 0); //constants!!
- pout << "Gained dexterity!" << Std::endl;
+ pout << "Gained _dexterity!" << Std::endl;
}
}
void MainActor::accumulateInt(int n) {
// already max?
- if (intelligence == 25) return; //!! constant
+ if (_intelligence == 25) return; //!! constant
accumInt += n;
if (accumInt >= 650 || getRandom() % (650 - accumInt) == 0) { //!! constant
- intelligence++;
+ _intelligence++;
accumInt = 0;
AudioProcess *audioproc = AudioProcess::get_instance();
if (audioproc) audioproc->playSFX(0x36, 0x60, 1, 0); //constants!!
- pout << "Gained intelligence!" << Std::endl;
+ pout << "Gained _intelligence!" << Std::endl;
}
}
@@ -507,7 +507,7 @@ void MainActor::getWeaponOverlay(const WeaponOverlayFrame *&frame_, uint32 &shap
shape_ = 0;
frame_ = 0;
- if (!isInCombat() && lastanim != Animation::unreadyWeapon) return;
+ if (!isInCombat() && _lastAnim != Animation::unreadyWeapon) return;
ObjId weaponid = getEquip(ShapeInfo::SE_WEAPON);
Item *weapon = getItem(weaponid);
@@ -522,8 +522,8 @@ void MainActor::getWeaponOverlay(const WeaponOverlayFrame *&frame_, uint32 &shap
shape_ = weaponinfo->overlay_shape;
WpnOvlayDat *wpnovlay = GameData::get_instance()->getWeaponOverlay();
- frame_ = wpnovlay->getOverlayFrame(lastanim, weaponinfo->overlay_type,
- direction, animframe);
+ frame_ = wpnovlay->getOverlayFrame(_lastAnim, weaponinfo->overlay_type,
+ _direction, _animFrame);
if (frame_ == 0) shape_ = 0;
}
Commit: de6256ed5887fd8e123a6de6fce912b3f0cabaa5
https://github.com/scummvm/scummvm/commit/de6256ed5887fd8e123a6de6fce912b3f0cabaa5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-17T19:42:21-08:00
Commit Message:
ULTIMA8: Renaming actors folder class fields
Changed paths:
engines/ultima/ultima8/graphics/type_flags.cpp
engines/ultima/ultima8/world/actors/actor.cpp
engines/ultima/ultima8/world/actors/avatar_gravity_process.h
engines/ultima/ultima8/world/actors/avatar_mover_process.cpp
engines/ultima/ultima8/world/actors/avatar_mover_process.h
engines/ultima/ultima8/world/actors/combat_process.cpp
engines/ultima/ultima8/world/actors/combat_process.h
engines/ultima/ultima8/world/actors/grant_peace_process.cpp
engines/ultima/ultima8/world/actors/grant_peace_process.h
engines/ultima/ultima8/world/actors/heal_process.cpp
engines/ultima/ultima8/world/actors/heal_process.h
engines/ultima/ultima8/world/actors/main_actor.cpp
engines/ultima/ultima8/world/actors/main_actor.h
engines/ultima/ultima8/world/actors/monster_info.h
diff --git a/engines/ultima/ultima8/graphics/type_flags.cpp b/engines/ultima/ultima8/graphics/type_flags.cpp
index 95aaf53..8b4d8ab 100644
--- a/engines/ultima/ultima8/graphics/type_flags.cpp
+++ b/engines/ultima/ultima8/graphics/type_flags.cpp
@@ -295,75 +295,75 @@ void TypeFlags::loadMonsterInfo() {
int val;
config->get(k + "/shape", val);
- mi->shape = static_cast<uint32>(val);
+ mi->_shape = static_cast<uint32>(val);
config->get(k + "/hp_min", val);
- mi->min_hp = static_cast<uint16>(val);
+ mi->_minHp = static_cast<uint16>(val);
config->get(k + "/hp_max", val);
- mi->max_hp = static_cast<uint16>(val);
+ mi->_maxHp = static_cast<uint16>(val);
config->get(k + "/dex_min", val);
- mi->min_dex = static_cast<uint16>(val);
+ mi->_minDex = static_cast<uint16>(val);
config->get(k + "/dex_max", val);
- mi->max_dex = static_cast<uint16>(val);
+ mi->_maxDex = static_cast<uint16>(val);
config->get(k + "/damage_min", val);
- mi->min_dmg = static_cast<uint16>(val);
+ mi->_minDmg = static_cast<uint16>(val);
config->get(k + "/damage_max", val);
- mi->max_dmg = static_cast<uint16>(val);
+ mi->_maxDmg = static_cast<uint16>(val);
config->get(k + "/armour", val);
- mi->armour_class = static_cast<uint16>(val);
+ mi->_armourClass = static_cast<uint16>(val);
config->get(k + "/alignment", val);
- mi->alignment = static_cast<uint8>(val);
+ mi->_alignment = static_cast<uint8>(val);
config->get(k + "/unk", val);
- mi->unk = (val != 0);
+ mi->_unk = (val != 0);
config->get(k + "/damage_type", val);
- mi->damage_type = static_cast<uint16>(val);
+ mi->_damageType = static_cast<uint16>(val);
config->get(k + "/defense_type", val);
- mi->defense_type = static_cast<uint16>(val);
+ mi->_defenseType = static_cast<uint16>(val);
if (config->get(k + "/resurrection", val))
- mi->resurrection = (val != 0);
+ mi->_resurrection = (val != 0);
else
- mi->resurrection = false;
+ mi->_resurrection = false;
if (config->get(k + "/ranged", val))
- mi->ranged = (val != 0);
+ mi->_ranged = (val != 0);
else
- mi->ranged = false;
+ mi->_ranged = false;
if (config->get(k + "/shifter", val))
- mi->shifter = (val != 0);
+ mi->_shifter = (val != 0);
else
- mi->shifter = false;
+ mi->_shifter = false;
if (config->get(k + "/explode", val))
- mi->explode = val;
+ mi->_explode = val;
else
- mi->explode = 0;
+ mi->_explode = 0;
Std::string treasure;
if (config->get(k + "/treasure", treasure)) {
- bool ok = treasureLoader.parse(treasure, mi->treasure);
+ bool ok = treasureLoader.parse(treasure, mi->_treasure);
if (!ok) {
perr << "failed to parse treasure info for monster '" << k
<< "'" << Std::endl;
- mi->treasure.clear();
+ mi->_treasure.clear();
}
} else {
- mi->treasure.clear();
+ mi->_treasure.clear();
}
- assert(mi->shape < shapeInfo.size());
- shapeInfo[mi->shape]._monsterInfo = mi;
+ assert(mi->_shape < shapeInfo.size());
+ shapeInfo[mi->_shape]._monsterInfo = mi;
}
}
diff --git a/engines/ultima/ultima8/world/actors/actor.cpp b/engines/ultima/ultima8/world/actors/actor.cpp
index 178312b..50f8cfe 100644
--- a/engines/ultima/ultima8/world/actors/actor.cpp
+++ b/engines/ultima/ultima8/world/actors/actor.cpp
@@ -100,20 +100,20 @@ bool Actor::loadMonsterStats() {
return false;
uint16 hp;
- if (mi->max_hp <= mi->min_hp)
- hp = mi->min_hp;
+ if (mi->_maxHp <= mi->_minHp)
+ hp = mi->_minHp;
else
- hp = mi->min_hp + getRandom() % (mi->max_hp - mi->min_hp);
+ hp = mi->_minHp + getRandom() % (mi->_maxHp - mi->_minHp);
setHP(hp);
uint16 dex;
- if (mi->max_dex <= mi->min_dex)
- dex = mi->min_dex;
+ if (mi->_maxDex <= mi->_minDex)
+ dex = mi->_minDex;
else
- dex = mi->min_dex + getRandom() % (mi->max_dex - mi->min_dex);
+ dex = mi->_minDex + getRandom() % (mi->_maxDex - mi->_minDex);
setDex(dex);
- uint8 new_alignment = mi->alignment;
+ uint8 new_alignment = mi->_alignment;
setAlignment(new_alignment & 0x0F);
setEnemyAlignment((new_alignment & 0xF0) >> 4); // !! CHECKME
@@ -128,7 +128,7 @@ bool Actor::giveTreasure() {
if (!mi)
return false;
- Std::vector<TreasureInfo> &treasure = mi->treasure;
+ Std::vector<TreasureInfo> &treasure = mi->_treasure;
for (unsigned int i = 0; i < treasure.size(); ++i) {
TreasureInfo &ti = treasure[i];
@@ -535,7 +535,7 @@ uint16 Actor::cSetActivity(int activity) {
uint32 Actor::getArmourClass() {
ShapeInfo *si = getShapeInfo();
if (si->_monsterInfo)
- return si->_monsterInfo->armour_class;
+ return si->_monsterInfo->_armourClass;
else
return 0;
}
@@ -543,7 +543,7 @@ uint32 Actor::getArmourClass() {
uint16 Actor::getDefenseType() {
ShapeInfo *si = getShapeInfo();
if (si->_monsterInfo)
- return si->_monsterInfo->defense_type;
+ return si->_monsterInfo->_defenseType;
else
return 0;
}
@@ -559,7 +559,7 @@ int16 Actor::getAttackingDex() {
uint16 Actor::getDamageType() {
ShapeInfo *si = getShapeInfo();
if (si->_monsterInfo)
- return si->_monsterInfo->damage_type;
+ return si->_monsterInfo->_damageType;
else
return WeaponInfo::DMG_NORMAL;
}
@@ -569,8 +569,8 @@ int Actor::getDamageAmount() {
ShapeInfo *si = getShapeInfo();
if (si->_monsterInfo) {
- int min = static_cast<int>(si->_monsterInfo->min_dmg);
- int max = static_cast<int>(si->_monsterInfo->max_dmg);
+ int min = static_cast<int>(si->_monsterInfo->_minDmg);
+ int max = static_cast<int>(si->_monsterInfo->_maxDmg);
int damage = (getRandom() % (max - min + 1)) + min;
@@ -754,7 +754,7 @@ ProcId Actor::die(uint16 damageType) {
MonsterInfo *mi = 0;
if (shapeinfo) mi = shapeinfo->_monsterInfo;
- if (mi && mi->resurrection && !(damageType & WeaponInfo::DMG_FIRE)) {
+ if (mi && mi->_resurrection && !(damageType & WeaponInfo::DMG_FIRE)) {
// this monster will be resurrected after a while
pout << "Actor::die: scheduling resurrection" << Std::endl;
@@ -775,19 +775,19 @@ ProcId Actor::die(uint16 damageType) {
animproc->waitFor(resproc);
}
- if (mi && mi->explode) {
+ if (mi && mi->_explode) {
// this monster explodes when it dies
pout << "Actor::die: exploding" << Std::endl;
int count = 5;
Shape *explosionshape = GameData::get_instance()->getMainShapes()
- ->getShape(mi->explode);
+ ->getShape(mi->_explode);
assert(explosionshape);
unsigned int framecount = explosionshape->frameCount();
for (int i = 0; i < count; ++i) {
- Item *piece = ItemFactory::createItem(mi->explode,
+ Item *piece = ItemFactory::createItem(mi->_explode,
getRandom() % framecount,
0, // qual
Item::FLG_FAST_ONLY, //flags,
diff --git a/engines/ultima/ultima8/world/actors/avatar_gravity_process.h b/engines/ultima/ultima8/world/actors/avatar_gravity_process.h
index 0a50075..322cb1f 100644
--- a/engines/ultima/ultima8/world/actors/avatar_gravity_process.h
+++ b/engines/ultima/ultima8/world/actors/avatar_gravity_process.h
@@ -43,8 +43,6 @@ public:
bool loadData(IDataSource *ids, uint32 version);
protected:
void saveData(ODataSource *ods) override;
-
- bool cling;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/actors/avatar_mover_process.cpp b/engines/ultima/ultima8/world/actors/avatar_mover_process.cpp
index e3029d0..5144764 100644
--- a/engines/ultima/ultima8/world/actors/avatar_mover_process.cpp
+++ b/engines/ultima/ultima8/world/actors/avatar_mover_process.cpp
@@ -45,16 +45,16 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(AvatarMoverProcess, Process)
AvatarMoverProcess::AvatarMoverProcess() : Process() {
- lastframe = 0;
- lastAttack = 0;
- idleTime = 0;
- lastHeadShakeAnim = Animation::lookLeft;
- mouseButton[0]._state = MBS_HANDLED | MBS_RELHANDLED;
- mouseButton[1]._state = MBS_HANDLED | MBS_RELHANDLED;
- mouseButton[0]._curDown = 0;
- mouseButton[1]._curDown = 0;
- mouseButton[0]._lastDown = 0;
- mouseButton[1]._lastDown = 0;
+ _lastFrame = 0;
+ _lastAttack = 0;
+ _idleTime = 0;
+ _lastHeadShakeAnim = Animation::lookLeft;
+ _mouseButton[0]._state = MBS_HANDLED | MBS_RELHANDLED;
+ _mouseButton[1]._state = MBS_HANDLED | MBS_RELHANDLED;
+ _mouseButton[0]._curDown = 0;
+ _mouseButton[1]._curDown = 0;
+ _mouseButton[0]._lastDown = 0;
+ _mouseButton[1]._lastDown = 0;
_type = 1; // CONSTANT! (type 1 = persistent)
}
@@ -68,16 +68,16 @@ void AvatarMoverProcess::run() {
uint32 framenum = kernel->getFrameNum();
// only run once per frame
- if (framenum == lastframe)
+ if (framenum == _lastFrame)
return;
- lastframe = framenum;
+ _lastFrame = framenum;
MainActor *avatar = getMainActor();
// busy, so don't move
if (kernel->getNumProcesses(1, 0x00F0) > 0) {
- idleTime = 0;
+ _idleTime = 0;
return;
}
@@ -89,7 +89,7 @@ void AvatarMoverProcess::run() {
// falling, so don't move
if (avatar->getGravityPID() != 0) {
- idleTime = 0;
+ _idleTime = 0;
return;
}
@@ -106,34 +106,34 @@ void AvatarMoverProcess::handleHangingMode() {
uint32 now = g_system->getMillis();
bool stasis = guiapp->isAvatarInStasis();
- idleTime = 0;
+ _idleTime = 0;
if (stasis) return;
bool m0clicked = false;
//bool m1clicked = false;
- if (!(mouseButton[0]._state & MBS_HANDLED) &&
- now - mouseButton[0]._curDown > DOUBLE_CLICK_TIMEOUT) {
+ if (!(_mouseButton[0]._state & MBS_HANDLED) &&
+ now - _mouseButton[0]._curDown > DOUBLE_CLICK_TIMEOUT) {
m0clicked = true;
- mouseButton[0]._state |= MBS_HANDLED;
+ _mouseButton[0]._state |= MBS_HANDLED;
}
- if (!(mouseButton[1]._state & MBS_HANDLED) &&
- now - mouseButton[1]._curDown > DOUBLE_CLICK_TIMEOUT) {
+ if (!(_mouseButton[1]._state & MBS_HANDLED) &&
+ now - _mouseButton[1]._curDown > DOUBLE_CLICK_TIMEOUT) {
//m1clicked = true;
- mouseButton[1]._state |= MBS_HANDLED;
+ _mouseButton[1]._state |= MBS_HANDLED;
}
- if (!(mouseButton[0]._state & MBS_RELHANDLED))
- mouseButton[0]._state |= MBS_RELHANDLED;
- if (!(mouseButton[1]._state & MBS_RELHANDLED))
- mouseButton[1]._state |= MBS_RELHANDLED;
+ if (!(_mouseButton[0]._state & MBS_RELHANDLED))
+ _mouseButton[0]._state |= MBS_RELHANDLED;
+ if (!(_mouseButton[1]._state & MBS_RELHANDLED))
+ _mouseButton[1]._state |= MBS_RELHANDLED;
// if left mouse is down, try to climb up
- if ((mouseButton[0]._state & MBS_DOWN) &&
- (!(mouseButton[0]._state & MBS_HANDLED) || m0clicked)) {
- mouseButton[0]._state |= MBS_HANDLED;
- mouseButton[0]._lastDown = 0;
+ if ((_mouseButton[0]._state & MBS_DOWN) &&
+ (!(_mouseButton[0]._state & MBS_HANDLED) || m0clicked)) {
+ _mouseButton[0]._state |= MBS_HANDLED;
+ _mouseButton[0]._lastDown = 0;
if (avatar->tryAnim(Animation::climb40, 8) == Animation::SUCCESS) {
avatar->ensureGravityProcess()->terminate();
@@ -160,7 +160,7 @@ void AvatarMoverProcess::handleCombatMode() {
int32 mousedir = (mouse->getMouseDirection(mx, my) + 7) % 8;
// never idle when in combat
- idleTime = 0;
+ _idleTime = 0;
// If Avatar has fallen down, stand up.
if (lastanim == Animation::die || lastanim == Animation::fallBackwards) {
@@ -171,7 +171,7 @@ void AvatarMoverProcess::handleCombatMode() {
// if we were blocking, and no longer holding the mouse, stop
if (lastanim == Animation::startBlock &&
- !(mouseButton[0]._state & MBS_DOWN)) {
+ !(_mouseButton[0]._state & MBS_DOWN)) {
// pout << "AvatarMover: combat stop blocking" << Std::endl;
waitFor(avatar->doAnim(Animation::stopBlock, direction));
return;
@@ -184,26 +184,26 @@ void AvatarMoverProcess::handleCombatMode() {
bool m0clicked = false;
bool m1clicked = false;
- if (!(mouseButton[0]._state & MBS_HANDLED) &&
- now - mouseButton[0]._curDown > DOUBLE_CLICK_TIMEOUT) {
+ if (!(_mouseButton[0]._state & MBS_HANDLED) &&
+ now - _mouseButton[0]._curDown > DOUBLE_CLICK_TIMEOUT) {
m0clicked = true;
- mouseButton[0]._state |= MBS_HANDLED;
+ _mouseButton[0]._state |= MBS_HANDLED;
}
- if (!(mouseButton[1]._state & MBS_HANDLED) &&
- now - mouseButton[1]._curDown > DOUBLE_CLICK_TIMEOUT) {
+ if (!(_mouseButton[1]._state & MBS_HANDLED) &&
+ now - _mouseButton[1]._curDown > DOUBLE_CLICK_TIMEOUT) {
m1clicked = true;
- mouseButton[1]._state |= MBS_HANDLED;
+ _mouseButton[1]._state |= MBS_HANDLED;
}
- if (!(mouseButton[0]._state & MBS_RELHANDLED))
- mouseButton[0]._state |= MBS_RELHANDLED;
+ if (!(_mouseButton[0]._state & MBS_RELHANDLED))
+ _mouseButton[0]._state |= MBS_RELHANDLED;
- if (!(mouseButton[1]._state & MBS_RELHANDLED))
- mouseButton[1]._state |= MBS_RELHANDLED;
+ if (!(_mouseButton[1]._state & MBS_RELHANDLED))
+ _mouseButton[1]._state |= MBS_RELHANDLED;
- if ((mouseButton[0]._state & MBS_DOWN) &&
- (mouseButton[0]._state & MBS_HANDLED) && mouseButton[0]._lastDown > 0) {
+ if ((_mouseButton[0]._state & MBS_DOWN) &&
+ (_mouseButton[0]._state & MBS_HANDLED) && _mouseButton[0]._lastDown > 0) {
// left click-and-hold = block
if (lastanim == Animation::startBlock)
return;
@@ -216,11 +216,11 @@ void AvatarMoverProcess::handleCombatMode() {
return;
}
- if ((mouseButton[0]._state & MBS_DOWN) &&
- !(mouseButton[0]._state & MBS_HANDLED) &&
- mouseButton[0]._curDown - mouseButton[0]._lastDown <= DOUBLE_CLICK_TIMEOUT) {
- mouseButton[0]._state |= MBS_HANDLED;
- mouseButton[0]._lastDown = 0;
+ if ((_mouseButton[0]._state & MBS_DOWN) &&
+ !(_mouseButton[0]._state & MBS_HANDLED) &&
+ _mouseButton[0]._curDown - _mouseButton[0]._lastDown <= DOUBLE_CLICK_TIMEOUT) {
+ _mouseButton[0]._state |= MBS_HANDLED;
+ _mouseButton[0]._lastDown = 0;
if (canAttack()) {
// double left click = attack
@@ -229,7 +229,7 @@ void AvatarMoverProcess::handleCombatMode() {
if (checkTurn(mousedir, true)) return;
waitFor(avatar->doAnim(Animation::attack, mousedir));
- lastAttack = lastframe;
+ _lastAttack = _lastFrame;
// attacking gives str/dex
avatar->accumulateStr(1 + (getRandom() % 2));
@@ -239,11 +239,11 @@ void AvatarMoverProcess::handleCombatMode() {
return;
}
- if ((mouseButton[1]._state & MBS_DOWN) &&
- !(mouseButton[1]._state & MBS_HANDLED) &&
- mouseButton[1]._curDown - mouseButton[1]._lastDown <= DOUBLE_CLICK_TIMEOUT) {
- mouseButton[1]._state |= MBS_HANDLED;
- mouseButton[1]._lastDown = 0;
+ if ((_mouseButton[1]._state & MBS_DOWN) &&
+ !(_mouseButton[1]._state & MBS_HANDLED) &&
+ _mouseButton[1]._curDown - _mouseButton[1]._lastDown <= DOUBLE_CLICK_TIMEOUT) {
+ _mouseButton[1]._state |= MBS_HANDLED;
+ _mouseButton[1]._lastDown = 0;
Gump *desktopgump = Ultima8Engine::get_instance()->getDesktopGump();
if (desktopgump->TraceObjId(mx, my) == 1) {
@@ -260,7 +260,7 @@ void AvatarMoverProcess::handleCombatMode() {
if (checkTurn(mousedir, false)) return;
waitFor(avatar->doAnim(Animation::kick, mousedir));
- lastAttack = lastframe;
+ _lastAttack = _lastFrame;
// kicking gives str/dex
avatar->accumulateStr(1 + (getRandom() % 2));
@@ -270,8 +270,8 @@ void AvatarMoverProcess::handleCombatMode() {
return;
}
- if ((mouseButton[1]._state & MBS_DOWN) &&
- (mouseButton[1]._state & MBS_HANDLED) && mouseButton[1]._lastDown > 0) {
+ if ((_mouseButton[1]._state & MBS_DOWN) &&
+ (_mouseButton[1]._state & MBS_HANDLED) && _mouseButton[1]._lastDown > 0) {
// right mouse button is down long enough to act on it
// if facing right direction, walk
//!! TODO: check if you can actually take this step
@@ -335,8 +335,8 @@ void AvatarMoverProcess::handleNormalMode() {
int32 mousedir = (mouse->getMouseDirection(mx, my) + 7) % 8;
// Store current idle time. (Also see end of function.)
- uint32 currentIdleTime = idleTime;
- idleTime = 0;
+ uint32 currentIdleTime = _idleTime;
+ _idleTime = 0;
// User toggled combat while in combatRun
if (avatar->isInCombat()) {
@@ -370,24 +370,24 @@ void AvatarMoverProcess::handleNormalMode() {
bool m1clicked = false;
// check mouse state to see what needs to be done
- if (!(mouseButton[0]._state & MBS_HANDLED) &&
- now - mouseButton[0]._curDown > DOUBLE_CLICK_TIMEOUT) {
+ if (!(_mouseButton[0]._state & MBS_HANDLED) &&
+ now - _mouseButton[0]._curDown > DOUBLE_CLICK_TIMEOUT) {
m0clicked = true;
- mouseButton[0]._state |= MBS_HANDLED;
+ _mouseButton[0]._state |= MBS_HANDLED;
}
- if (!(mouseButton[1]._state & MBS_HANDLED) &&
- now - mouseButton[1]._curDown > DOUBLE_CLICK_TIMEOUT) {
+ if (!(_mouseButton[1]._state & MBS_HANDLED) &&
+ now - _mouseButton[1]._curDown > DOUBLE_CLICK_TIMEOUT) {
m1clicked = true;
- mouseButton[1]._state |= MBS_HANDLED;
+ _mouseButton[1]._state |= MBS_HANDLED;
}
// see if mouse was just released
- if (!(mouseButton[0]._state & MBS_RELHANDLED))
- mouseButton[0]._state |= MBS_RELHANDLED; // don't care about left
+ if (!(_mouseButton[0]._state & MBS_RELHANDLED))
+ _mouseButton[0]._state |= MBS_RELHANDLED; // don't care about left
- if (!(mouseButton[1]._state & MBS_RELHANDLED)) {
- mouseButton[1]._state |= MBS_RELHANDLED;
+ if (!(_mouseButton[1]._state & MBS_RELHANDLED)) {
+ _mouseButton[1]._state |= MBS_RELHANDLED;
// if we were running in combat mode, slow to a walk, draw weapon
// (even in stasis)
@@ -427,19 +427,19 @@ void AvatarMoverProcess::handleNormalMode() {
return;
// both mouse buttons down
- if (!(mouseButton[0]._state & MBS_HANDLED) &&
- !(mouseButton[1]._state & MBS_HANDLED)) {
+ if (!(_mouseButton[0]._state & MBS_HANDLED) &&
+ !(_mouseButton[1]._state & MBS_HANDLED)) {
// notice these are all unsigned.
- uint32 down = mouseButton[1]._curDown;
- if (mouseButton[0]._curDown < down) {
- down = down - mouseButton[0]._curDown;
+ uint32 down = _mouseButton[1]._curDown;
+ if (_mouseButton[0]._curDown < down) {
+ down = down - _mouseButton[0]._curDown;
} else {
- down = mouseButton[0]._curDown - down;
+ down = _mouseButton[0]._curDown - down;
}
if (down < DOUBLE_CLICK_TIMEOUT) {
- mouseButton[0]._state |= MBS_HANDLED;
- mouseButton[1]._state |= MBS_HANDLED;
+ _mouseButton[0]._state |= MBS_HANDLED;
+ _mouseButton[1]._state |= MBS_HANDLED;
// We got a left mouse down.
// Note that this automatically means right was down too.
@@ -477,9 +477,9 @@ void AvatarMoverProcess::handleNormalMode() {
}
}
- if ((!(mouseButton[0]._state & MBS_HANDLED) || m0clicked) &&
- (mouseButton[1]._state & MBS_DOWN)) {
- mouseButton[0]._state |= MBS_HANDLED;
+ if ((!(_mouseButton[0]._state & MBS_HANDLED) || m0clicked) &&
+ (_mouseButton[1]._state & MBS_DOWN)) {
+ _mouseButton[0]._state |= MBS_HANDLED;
// We got a left mouse down.
// Note that this automatically means right was down at the time too.
@@ -505,14 +505,14 @@ void AvatarMoverProcess::handleNormalMode() {
// CHECKME: check what needs to happen when keeping left pressed
}
- if ((mouseButton[1]._state & MBS_DOWN) &&
- !(mouseButton[1]._state & MBS_HANDLED) &&
- mouseButton[1]._curDown - mouseButton[1]._lastDown <= DOUBLE_CLICK_TIMEOUT) {
+ if ((_mouseButton[1]._state & MBS_DOWN) &&
+ !(_mouseButton[1]._state & MBS_HANDLED) &&
+ _mouseButton[1]._curDown - _mouseButton[1]._lastDown <= DOUBLE_CLICK_TIMEOUT) {
Gump *desktopgump = Ultima8Engine::get_instance()->getDesktopGump();
if (desktopgump->TraceObjId(mx, my) == 1) {
// double right click on avatar = toggle combat mode
- mouseButton[1]._state |= MBS_HANDLED;
- mouseButton[1]._lastDown = 0;
+ _mouseButton[1]._state |= MBS_HANDLED;
+ _mouseButton[1]._lastDown = 0;
avatar->toggleInCombat();
waitFor(avatar->doAnim(Animation::readyWeapon, direction));
@@ -520,8 +520,8 @@ void AvatarMoverProcess::handleNormalMode() {
}
}
- if ((mouseButton[1]._state & MBS_DOWN) &&
- (mouseButton[1]._state & MBS_HANDLED)) {
+ if ((_mouseButton[1]._state & MBS_DOWN) &&
+ (_mouseButton[1]._state & MBS_HANDLED)) {
// right mouse button is down long enough to act on it
// if facing right direction, walk
@@ -551,26 +551,26 @@ void AvatarMoverProcess::handleNormalMode() {
return;
// idle
- idleTime = currentIdleTime + 1;
+ _idleTime = currentIdleTime + 1;
// currently shaking head?
if (lastanim == Animation::lookLeft || lastanim == Animation::lookRight) {
- if ((getRandom() % 1500) + 30 < idleTime) {
- lastHeadShakeAnim = lastanim;
+ if ((getRandom() % 1500) + 30 < _idleTime) {
+ _lastHeadShakeAnim = lastanim;
waitFor(avatar->doAnim(Animation::stand, direction));
- idleTime = 0;
+ _idleTime = 0;
return;
}
} else {
- if ((getRandom() % 3000) + 150 < idleTime) {
+ if ((getRandom() % 3000) + 150 < _idleTime) {
if (getRandom() % 5 == 0)
- nextanim = lastHeadShakeAnim;
- else if (lastHeadShakeAnim == Animation::lookLeft)
+ nextanim = _lastHeadShakeAnim;
+ else if (_lastHeadShakeAnim == Animation::lookLeft)
nextanim = Animation::lookRight;
else
nextanim = Animation::lookLeft;
waitFor(avatar->doAnim(nextanim, direction));
- idleTime = 0;
+ _idleTime = 0;
}
}
}
@@ -777,7 +777,7 @@ bool AvatarMoverProcess::checkTurn(int direction, bool moving) {
bool AvatarMoverProcess::canAttack() {
MainActor *avatar = getMainActor();
- return (lastframe > lastAttack + (25 - avatar->getDex()));
+ return (_lastFrame > _lastAttack + (25 - avatar->getDex()));
}
void AvatarMoverProcess::OnMouseDown(int button, int32 mx, int32 my) {
@@ -797,10 +797,10 @@ void AvatarMoverProcess::OnMouseDown(int button, int32 mx, int32 my) {
break;
};
- mouseButton[bid]._lastDown = mouseButton[bid]._curDown;
- mouseButton[bid]._curDown = g_system->getMillis();
- mouseButton[bid]._state |= MBS_DOWN;
- mouseButton[bid]._state &= ~MBS_HANDLED;
+ _mouseButton[bid]._lastDown = _mouseButton[bid]._curDown;
+ _mouseButton[bid]._curDown = g_system->getMillis();
+ _mouseButton[bid]._state |= MBS_DOWN;
+ _mouseButton[bid]._state &= ~MBS_HANDLED;
}
void AvatarMoverProcess::OnMouseUp(int button) {
@@ -814,25 +814,25 @@ void AvatarMoverProcess::OnMouseUp(int button) {
CANT_HAPPEN_MSG("invalid MouseUp passed to AvatarMoverProcess");
}
- mouseButton[bid]._state &= ~MBS_DOWN;
- mouseButton[bid]._state &= ~MBS_RELHANDLED;
+ _mouseButton[bid]._state &= ~MBS_DOWN;
+ _mouseButton[bid]._state &= ~MBS_RELHANDLED;
}
void AvatarMoverProcess::saveData(ODataSource *ods) {
Process::saveData(ods);
- ods->write4(lastAttack);
- ods->write4(idleTime);
- ods->write2(static_cast<uint8>(lastHeadShakeAnim));
+ ods->write4(_lastAttack);
+ ods->write4(_idleTime);
+ ods->write2(static_cast<uint8>(_lastHeadShakeAnim));
}
bool AvatarMoverProcess::loadData(IDataSource *ids, uint32 version) {
if (!Process::loadData(ids, version)) return false;
- lastAttack = ids->read4();
- idleTime = ids->read4();
- lastHeadShakeAnim = static_cast<Animation::Sequence>(ids->read2());
+ _lastAttack = ids->read4();
+ _idleTime = ids->read4();
+ _lastHeadShakeAnim = static_cast<Animation::Sequence>(ids->read2());
return true;
}
diff --git a/engines/ultima/ultima8/world/actors/avatar_mover_process.h b/engines/ultima/ultima8/world/actors/avatar_mover_process.h
index 6692d91..5292e74 100644
--- a/engines/ultima/ultima8/world/actors/avatar_mover_process.h
+++ b/engines/ultima/ultima8/world/actors/avatar_mover_process.h
@@ -44,7 +44,7 @@ public:
void OnMouseUp(int button);
void resetIdleTime() {
- idleTime = 0;
+ _idleTime = 0;
}
bool loadData(IDataSource *ids, uint32 version);
@@ -61,16 +61,16 @@ protected:
bool checkTurn(int direction, bool moving);
bool canAttack();
- uint32 lastframe;
+ uint32 _lastFrame;
// attack speed limiting
- uint32 lastAttack;
+ uint32 _lastAttack;
// shake head when idle
- uint32 idleTime;
- Animation::Sequence lastHeadShakeAnim;
+ uint32 _idleTime;
+ Animation::Sequence _lastHeadShakeAnim;
- MButton mouseButton[2];
+ MButton _mouseButton[2];
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/actors/combat_process.cpp b/engines/ultima/ultima8/world/actors/combat_process.cpp
index d075cd5..f3b45aa 100644
--- a/engines/ultima/ultima8/world/actors/combat_process.cpp
+++ b/engines/ultima/ultima8/world/actors/combat_process.cpp
@@ -21,7 +21,6 @@
*/
#include "ultima/ultima8/misc/pent_include.h"
-
#include "ultima/ultima8/world/actors/combat_process.h"
#include "ultima/ultima8/world/actors/actor.h"
#include "ultima/ultima8/world/current_map.h"
@@ -38,7 +37,6 @@
#include "ultima/ultima8/world/get_object.h"
#include "ultima/ultima8/world/actors/loiter_process.h"
#include "ultima/ultima8/world/actors/ambush_process.h"
-
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/filesys/odata_source.h"
@@ -57,9 +55,9 @@ CombatProcess::CombatProcess(Actor *actor_) {
_itemNum = actor_->getObjId();
_type = 0x00F2; // CONSTANT !
- target = 0;
- fixedTarget = 0;
- combatmode = CM_WAITING;
+ _target = 0;
+ _fixedTarget = 0;
+ _combatMode = CM_WAITING;
}
void CombatProcess::terminate() {
@@ -80,21 +78,21 @@ void CombatProcess::run() {
if (!(a->getFlags() & Item::FLG_FASTAREA))
return;
- Actor *t = getActor(target);
+ Actor *t = getActor(_target);
if (!t || !isValidTarget(t)) {
- // no target? try to find one
+ // no _target? try to find one
- target = seekTarget();
+ _target = seekTarget();
- if (!target) {
+ if (!_target) {
waitForTarget();
return;
}
- pout << "[COMBAT " << _itemNum << "] target found: "
- << target << Std::endl;
- combatmode = CM_WAITING;
+ pout << "[COMBAT " << _itemNum << "] _target found: "
+ << _target << Std::endl;
+ _combatMode = CM_WAITING;
}
int targetdir = getTargetDirection();
@@ -104,9 +102,9 @@ void CombatProcess::run() {
}
if (inAttackRange()) {
- combatmode = CM_ATTACKING;
+ _combatMode = CM_ATTACKING;
- pout << "[COMBAT " << _itemNum << "] target (" << target
+ pout << "[COMBAT " << _itemNum << "] _target (" << _target
<< ") in range" << Std::endl;
bool hasidle1 = a->hasAnim(Animation::idle1);
@@ -148,35 +146,35 @@ void CombatProcess::run() {
}
return;
- } else if (combatmode != CM_PATHFINDING) {
+ } else if (_combatMode != CM_PATHFINDING) {
// not in range? See if we can get in range
- Process *pfproc = new PathfinderProcess(a, target, true);
+ Process *pfproc = new PathfinderProcess(a, _target, true);
waitFor(Kernel::get_instance()->addProcess(pfproc));
- combatmode = CM_PATHFINDING;
+ _combatMode = CM_PATHFINDING;
return;
}
- combatmode = CM_WAITING;
+ _combatMode = CM_WAITING;
waitForTarget();
}
ObjId CombatProcess::getTarget() {
- Actor *t = getActor(target);
+ Actor *t = getActor(_target);
if (!t || !isValidTarget(t))
- target = 0;
+ _target = 0;
- return target;
+ return _target;
}
void CombatProcess::setTarget(ObjId newtarget) {
- if (fixedTarget == 0) {
- fixedTarget = newtarget; // want to prevent seekTarget from changing it
+ if (_fixedTarget == 0) {
+ _fixedTarget = newtarget; // want to prevent seekTarget from changing it
}
- target = newtarget;
+ _target = newtarget;
}
bool CombatProcess::isValidTarget(Actor *target_) {
@@ -217,10 +215,10 @@ ObjId CombatProcess::seekTarget() {
Actor *a = getActor(_itemNum);
if (!a) return 0; // uh oh
- if (fixedTarget) {
- Actor *t = getActor(fixedTarget);
+ if (_fixedTarget) {
+ Actor *t = getActor(_fixedTarget);
if (t && isValidTarget(t))
- return fixedTarget; // no need to search
+ return _fixedTarget; // no need to search
}
UCList itemlist(2);
@@ -232,7 +230,7 @@ ObjId CombatProcess::seekTarget() {
Actor *t = getActor(itemlist.getuint16(i));
if (t && isValidTarget(t) && isEnemy(t)) {
- // found target
+ // found _target
return itemlist.getuint16(i);
}
}
@@ -243,7 +241,7 @@ ObjId CombatProcess::seekTarget() {
int CombatProcess::getTargetDirection() {
Actor *a = getActor(_itemNum);
- Actor *t = getActor(target);
+ Actor *t = getActor(_target);
return a->getDirToItemCentre(*t);
}
@@ -283,7 +281,7 @@ bool CombatProcess::inAttackRange() {
MonsterInfo *mi = 0;
if (shapeinfo) mi = shapeinfo->_monsterInfo;
- if (mi && mi->ranged)
+ if (mi && mi->_ranged)
return true; // ranged attacks (ghost's fireball) always in range
AnimationTracker tracker;
@@ -295,7 +293,7 @@ bool CombatProcess::inAttackRange() {
}
ObjId hit = tracker.hitSomething();
- if (hit == target) return true;
+ if (hit == _target) return true;
return false;
}
@@ -306,7 +304,7 @@ void CombatProcess::waitForTarget() {
MonsterInfo *mi = 0;
if (shapeinfo) mi = shapeinfo->_monsterInfo;
- if (mi && mi->shifter && a->getMapNum() != 43 && (getRandom() % 2) == 0) {
+ if (mi && mi->_shifter && a->getMapNum() != 43 && (getRandom() % 2) == 0) {
// changelings (except the ones at the U8 endgame pentagram)
// shift into a tree if nobody is around
@@ -328,23 +326,23 @@ void CombatProcess::waitForTarget() {
void CombatProcess::dumpInfo() {
Process::dumpInfo();
- pout << "Target: " << target << Std::endl;
+ pout << "Target: " << _target << Std::endl;
}
void CombatProcess::saveData(ODataSource *ods) {
Process::saveData(ods);
- ods->write2(target);
- ods->write2(fixedTarget);
- ods->write1(static_cast<uint8>(combatmode));
+ ods->write2(_target);
+ ods->write2(_fixedTarget);
+ ods->write1(static_cast<uint8>(_combatMode));
}
bool CombatProcess::loadData(IDataSource *ids, uint32 version) {
if (!Process::loadData(ids, version)) return false;
- target = ids->read2();
- fixedTarget = ids->read2();
- combatmode = static_cast<CombatMode>(ids->read1());
+ _target = ids->read2();
+ _fixedTarget = ids->read2();
+ _combatMode = static_cast<CombatMode>(ids->read1());
return true;
}
diff --git a/engines/ultima/ultima8/world/actors/combat_process.h b/engines/ultima/ultima8/world/actors/combat_process.h
index 16859b8..193e214 100644
--- a/engines/ultima/ultima8/world/actors/combat_process.h
+++ b/engines/ultima/ultima8/world/actors/combat_process.h
@@ -60,14 +60,14 @@ protected:
void turnToDirection(int direction);
void waitForTarget();
- ObjId target;
- ObjId fixedTarget;
+ ObjId _target;
+ ObjId _fixedTarget;
enum CombatMode {
CM_WAITING = 0,
CM_PATHFINDING,
CM_ATTACKING
- } combatmode;
+ } _combatMode;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/actors/grant_peace_process.cpp b/engines/ultima/ultima8/world/actors/grant_peace_process.cpp
index d1b243a..505e1a2 100644
--- a/engines/ultima/ultima8/world/actors/grant_peace_process.cpp
+++ b/engines/ultima/ultima8/world/actors/grant_peace_process.cpp
@@ -21,7 +21,6 @@
*/
#include "ultima/ultima8/misc/pent_include.h"
-
#include "ultima/ultima8/world/actors/grant_peace_process.h"
#include "ultima/ultima8/world/world.h"
#include "ultima/ultima8/world/actors/actor.h"
@@ -38,7 +37,6 @@
#include "ultima/ultima8/world/sprite_process.h"
#include "ultima/ultima8/audio/audio_process.h"
#include "ultima/ultima8/world/get_object.h"
-
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/filesys/odata_source.h"
@@ -48,8 +46,7 @@ namespace Ultima8 {
// p_dynamic_cast stuff
DEFINE_RUNTIME_CLASSTYPE_CODE(GrantPeaceProcess, Process)
-GrantPeaceProcess::GrantPeaceProcess() : Process() {
-
+GrantPeaceProcess::GrantPeaceProcess() : Process(), _haveTarget(false) {
}
GrantPeaceProcess::GrantPeaceProcess(Actor *caster) {
@@ -58,7 +55,7 @@ GrantPeaceProcess::GrantPeaceProcess(Actor *caster) {
_type = 0x21d; // CONSTANT !
- havetarget = false;
+ _haveTarget = false;
}
void GrantPeaceProcess::run() {
@@ -68,13 +65,13 @@ void GrantPeaceProcess::run() {
return;
}
- if (!havetarget) {
+ if (!_haveTarget) {
TargetGump *targetgump = new TargetGump(0, 0);
targetgump->InitGump(0);
waitFor(targetgump->GetNotifyProcess()->getPid());
- havetarget = true;
+ _haveTarget = true;
return;
}
@@ -224,14 +221,14 @@ uint32 GrantPeaceProcess::I_castGrantPeace(const uint8 *args,
void GrantPeaceProcess::saveData(ODataSource *ods) {
Process::saveData(ods);
- uint8 ht = havetarget ? 1 : 0;
+ uint8 ht = _haveTarget ? 1 : 0;
ods->write1(ht);
}
bool GrantPeaceProcess::loadData(IDataSource *ids, uint32 version) {
if (!Process::loadData(ids, version)) return false;
- havetarget = (ids->read1() != 0);
+ _haveTarget = (ids->read1() != 0);
return true;
}
diff --git a/engines/ultima/ultima8/world/actors/grant_peace_process.h b/engines/ultima/ultima8/world/actors/grant_peace_process.h
index 7bd0f1d..5a1fdab 100644
--- a/engines/ultima/ultima8/world/actors/grant_peace_process.h
+++ b/engines/ultima/ultima8/world/actors/grant_peace_process.h
@@ -47,7 +47,7 @@ public:
protected:
void saveData(ODataSource *ods) override;
- bool havetarget;
+ bool _haveTarget;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/actors/heal_process.cpp b/engines/ultima/ultima8/world/actors/heal_process.cpp
index 58530e4..b79b8bf 100644
--- a/engines/ultima/ultima8/world/actors/heal_process.cpp
+++ b/engines/ultima/ultima8/world/actors/heal_process.cpp
@@ -21,12 +21,10 @@
*/
#include "ultima/ultima8/misc/pent_include.h"
-
#include "ultima/ultima8/world/actors/heal_process.h"
#include "ultima/ultima8/world/actors/main_actor.h"
#include "ultima/ultima8/kernel/kernel.h"
#include "ultima/ultima8/world/get_object.h"
-
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/filesys/odata_source.h"
@@ -37,8 +35,8 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(HealProcess, Process)
HealProcess::HealProcess() : Process() {
- hungerCounter = 0;
- healCounter = 0;
+ _hungerCounter = 0;
+ _healCounter = 0;
_itemNum = 0;
_type = 0x222; // CONSTANT!
}
@@ -54,9 +52,9 @@ void HealProcess::run() {
// heal one hitpoint and one manapoint every minute (1800 frames)
- healCounter++;
+ _healCounter++;
- if (healCounter == 900) {
+ if (_healCounter == 900) {
int16 mana = avatar->getMana();
if (mana < avatar->getMaxMana()) {
mana++;
@@ -64,16 +62,16 @@ void HealProcess::run() {
}
}
- if (healCounter == 1800) {
+ if (_healCounter == 1800) {
uint16 hp = avatar->getHP();
if (hp < avatar->getMaxHP()) {
hp++;
avatar->setHP(hp);
}
- healCounter = 0;
+ _healCounter = 0;
- if (hungerCounter < 200)
- hungerCounter++;
+ if (_hungerCounter < 200)
+ _hungerCounter++;
}
}
@@ -86,15 +84,15 @@ void HealProcess::feedAvatar(uint16 food) {
return;
}
- if (food > hungerCounter)
- food = hungerCounter;
+ if (food > _hungerCounter)
+ food = _hungerCounter;
if (food == 0) return;
- uint16 oldCounter = hungerCounter;
- hungerCounter -= food;
+ uint16 oldCounter = _hungerCounter;
+ _hungerCounter -= food;
- uint16 hp = avatar->getHP() - (hungerCounter / 4) + (oldCounter / 4);
+ uint16 hp = avatar->getHP() - (_hungerCounter / 4) + (oldCounter / 4);
if (hp > avatar->getMaxHP()) hp = avatar->getMaxHP();
avatar->setHP(hp);
@@ -119,15 +117,15 @@ uint32 HealProcess::I_feedAvatar(const uint8 *args, unsigned int /*argsize*/) {
void HealProcess::saveData(ODataSource *ods) {
Process::saveData(ods);
- ods->write2(healCounter);
- ods->write2(hungerCounter);
+ ods->write2(_healCounter);
+ ods->write2(_hungerCounter);
}
bool HealProcess::loadData(IDataSource *ids, uint32 version) {
if (!Process::loadData(ids, version)) return false;
- healCounter = ids->read2();
- hungerCounter = ids->read2();
+ _healCounter = ids->read2();
+ _hungerCounter = ids->read2();
return true;
}
diff --git a/engines/ultima/ultima8/world/actors/heal_process.h b/engines/ultima/ultima8/world/actors/heal_process.h
index dd89a96..dbc7612 100644
--- a/engines/ultima/ultima8/world/actors/heal_process.h
+++ b/engines/ultima/ultima8/world/actors/heal_process.h
@@ -46,8 +46,8 @@ protected:
void feedAvatar(uint16 food);
- uint16 healCounter;
- uint16 hungerCounter;
+ uint16 _healCounter;
+ uint16 _hungerCounter;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/actors/main_actor.cpp b/engines/ultima/ultima8/world/actors/main_actor.cpp
index 2929414..bbd5822 100644
--- a/engines/ultima/ultima8/world/actors/main_actor.cpp
+++ b/engines/ultima/ultima8/world/actors/main_actor.cpp
@@ -21,7 +21,6 @@
*/
#include "ultima/ultima8/misc/pent_include.h"
-
#include "ultima/ultima8/world/actors/main_actor.h"
#include "ultima/ultima8/world/teleport_egg.h"
#include "ultima/ultima8/world/current_map.h"
@@ -45,7 +44,6 @@
#include "ultima/ultima8/world/loop_script.h"
#include "ultima/ultima8/world/actors/avatar_gravity_process.h"
#include "ultima/ultima8/audio/music_process.h"
-
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/filesys/odata_source.h"
@@ -55,13 +53,11 @@ namespace Ultima8 {
// p_dynamic_cast stuff
DEFINE_RUNTIME_CLASSTYPE_CODE(MainActor, Actor)
-MainActor::MainActor() : justTeleported(false), accumStr(0), accumDex(0),
- accumInt(0) {
-
+MainActor::MainActor() : _justTeleported(false), _accumStr(0), _accumDex(0),
+ _accumInt(0) {
}
MainActor::~MainActor() {
-
}
GravityProcess *MainActor::ensureGravityProcess() {
@@ -126,7 +122,7 @@ void MainActor::teleport(int mapNum_, int32 x_, int32 y_, int32 z_) {
}
Actor::teleport(mapNum_, x_, y_, z_);
- justTeleported = true;
+ _justTeleported = true;
}
// teleport to TeleportEgg
@@ -167,7 +163,7 @@ void MainActor::teleport(int mapNum_, int teleport_id) {
egg->dumpInfo();
Actor::teleport(mapNum_, xv, yv, zv);
- justTeleported = true;
+ _justTeleported = true;
}
uint16 MainActor::getDefenseType() {
@@ -465,10 +461,10 @@ void MainActor::accumulateStr(int n) {
// already max?
if (_strength == 25) return; //!! constant
- accumStr += n;
- if (accumStr >= 650 || getRandom() % (650 - accumStr) == 0) { //!! constant
+ _accumStr += n;
+ if (_accumStr >= 650 || getRandom() % (650 - _accumStr) == 0) { //!! constant
_strength++;
- accumStr = 0;
+ _accumStr = 0;
AudioProcess *audioproc = AudioProcess::get_instance();
if (audioproc) audioproc->playSFX(0x36, 0x60, 1, 0); //constants!!
pout << "Gained _strength!" << Std::endl;
@@ -479,10 +475,10 @@ void MainActor::accumulateDex(int n) {
// already max?
if (_dexterity == 25) return; //!! constant
- accumDex += n;
- if (accumDex >= 650 || getRandom() % (650 - accumDex) == 0) { //!! constant
+ _accumDex += n;
+ if (_accumDex >= 650 || getRandom() % (650 - _accumDex) == 0) { //!! constant
_dexterity++;
- accumDex = 0;
+ _accumDex = 0;
AudioProcess *audioproc = AudioProcess::get_instance();
if (audioproc) audioproc->playSFX(0x36, 0x60, 1, 0); //constants!!
pout << "Gained _dexterity!" << Std::endl;
@@ -493,10 +489,10 @@ void MainActor::accumulateInt(int n) {
// already max?
if (_intelligence == 25) return; //!! constant
- accumInt += n;
- if (accumInt >= 650 || getRandom() % (650 - accumInt) == 0) { //!! constant
+ _accumInt += n;
+ if (_accumInt >= 650 || getRandom() % (650 - _accumInt) == 0) { //!! constant
_intelligence++;
- accumInt = 0;
+ _accumInt = 0;
AudioProcess *audioproc = AudioProcess::get_instance();
if (audioproc) audioproc->playSFX(0x36, 0x60, 1, 0); //constants!!
pout << "Gained _intelligence!" << Std::endl;
@@ -530,30 +526,30 @@ void MainActor::getWeaponOverlay(const WeaponOverlayFrame *&frame_, uint32 &shap
void MainActor::saveData(ODataSource *ods) {
Actor::saveData(ods);
- uint8 jt = justTeleported ? 1 : 0;
+ uint8 jt = _justTeleported ? 1 : 0;
ods->write1(jt);
- ods->write4(accumStr);
- ods->write4(accumDex);
- ods->write4(accumInt);
- uint8 namelength = static_cast<uint8>(name.size());
+ ods->write4(_accumStr);
+ ods->write4(_accumDex);
+ ods->write4(_accumInt);
+ uint8 namelength = static_cast<uint8>(_name.size());
ods->write1(namelength);
for (unsigned int i = 0; i < namelength; ++i)
- ods->write1(static_cast<uint8>(name[i]));
+ ods->write1(static_cast<uint8>(_name[i]));
}
bool MainActor::loadData(IDataSource *ids, uint32 version) {
if (!Actor::loadData(ids, version)) return false;
- justTeleported = (ids->read1() != 0);
- accumStr = static_cast<int32>(ids->read4());
- accumDex = static_cast<int32>(ids->read4());
- accumInt = static_cast<int32>(ids->read4());
+ _justTeleported = (ids->read1() != 0);
+ _accumStr = static_cast<int32>(ids->read4());
+ _accumDex = static_cast<int32>(ids->read4());
+ _accumInt = static_cast<int32>(ids->read4());
uint8 namelength = ids->read1();
- name.resize(namelength);
+ _name.resize(namelength);
for (unsigned int i = 0; i < namelength; ++i)
- name[i] = ids->read1();
+ _name[i] = ids->read1();
return true;
}
diff --git a/engines/ultima/ultima8/world/actors/main_actor.h b/engines/ultima/ultima8/world/actors/main_actor.h
index 1b9ca27..26b5a94 100644
--- a/engines/ultima/ultima8/world/actors/main_actor.h
+++ b/engines/ultima/ultima8/world/actors/main_actor.h
@@ -47,10 +47,10 @@ public:
void teleport(int mapNum_, int teleport_id); // to teleportegg
bool hasJustTeleported() const {
- return justTeleported;
+ return _justTeleported;
}
void setJustTeleported(bool t) {
- justTeleported = t;
+ _justTeleported = t;
}
//! accumulate a little bit of strength. When you reach 650 you gain
@@ -82,10 +82,10 @@ public:
ProcId die(uint16 DamageType) override;
Std::string getName() {
- return name;
+ return _name;
}
- void setName(Std::string name_) {
- name = name_;
+ void setName(const Std::string &name) {
+ _name = name;
}
bool loadData(IDataSource *ids, uint32 version);
@@ -142,13 +142,13 @@ protected:
void useInventoryItem(uint32 shapenum);
- bool justTeleported;
+ bool _justTeleported;
- int accumStr;
- int accumDex;
- int accumInt;
+ int _accumStr;
+ int _accumDex;
+ int _accumInt;
- Std::string name;
+ Std::string _name;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/actors/monster_info.h b/engines/ultima/ultima8/world/actors/monster_info.h
index 4154838..df208d0 100644
--- a/engines/ultima/ultima8/world/actors/monster_info.h
+++ b/engines/ultima/ultima8/world/actors/monster_info.h
@@ -29,21 +29,21 @@ namespace Ultima {
namespace Ultima8 {
struct MonsterInfo {
- uint32 shape;
- uint16 min_hp, max_hp;
- uint16 min_dex, max_dex;
- uint16 min_dmg, max_dmg;
- uint16 armour_class;
- uint8 alignment;
- bool unk;
- uint16 damage_type;
- uint16 defense_type;
- bool resurrection; // auto-resurrection after being killed
- bool ranged; // ranged attack
- bool shifter; // shapeshifter
- uint32 explode; // shape to hurl around after being killed (or 0)
+ uint32 _shape;
+ uint16 _minHp, _maxHp;
+ uint16 _minDex, _maxDex;
+ uint16 _minDmg, _maxDmg;
+ uint16 _armourClass;
+ uint8 _alignment;
+ bool _unk;
+ uint16 _damageType;
+ uint16 _defenseType;
+ bool _resurrection; // auto-resurrection after being killed
+ bool _ranged; // ranged attack
+ bool _shifter; // shapeshifter
+ uint32 _explode; // shape to hurl around after being killed (or 0)
- Std::vector<TreasureInfo> treasure;
+ Std::vector<TreasureInfo> _treasure;
};
} // End of namespace Ultima8
Commit: 9c22eba28307d5f8a0c511d2c34625e332f6209a
https://github.com/scummvm/scummvm/commit/9c22eba28307d5f8a0c511d2c34625e332f6209a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-17T19:42:21-08:00
Commit Message:
ULTIMA8: Renaming actors folder class fields
Changed paths:
engines/ultima/ultima8/games/treasure_loader.cpp
engines/ultima/ultima8/world/actors/actor.cpp
engines/ultima/ultima8/world/actors/animation_tracker.cpp
engines/ultima/ultima8/world/actors/pathfinder.cpp
engines/ultima/ultima8/world/actors/pathfinder.h
engines/ultima/ultima8/world/actors/pathfinder_process.cpp
engines/ultima/ultima8/world/actors/pathfinder_process.h
engines/ultima/ultima8/world/actors/quick_avatar_mover_process.cpp
engines/ultima/ultima8/world/actors/quick_avatar_mover_process.h
engines/ultima/ultima8/world/actors/scheduler_process.cpp
engines/ultima/ultima8/world/actors/scheduler_process.h
engines/ultima/ultima8/world/actors/targeted_anim_process.cpp
engines/ultima/ultima8/world/actors/targeted_anim_process.h
engines/ultima/ultima8/world/actors/teleport_to_egg_process.cpp
engines/ultima/ultima8/world/actors/teleport_to_egg_process.h
engines/ultima/ultima8/world/actors/treasure_info.h
diff --git a/engines/ultima/ultima8/games/treasure_loader.cpp b/engines/ultima/ultima8/games/treasure_loader.cpp
index d313440..c0d9d9b 100644
--- a/engines/ultima/ultima8/games/treasure_loader.cpp
+++ b/engines/ultima/ultima8/games/treasure_loader.cpp
@@ -76,12 +76,12 @@ bool TreasureLoader::parse(Std::string desc,
bool TreasureLoader::internalParse(Std::string desc, TreasureInfo &ti,
bool loadingDefault) {
- ti.special = "";
- ti.chance = 1;
- ti.map = 0;
- ti.shapes.clear();
- ti.frames.clear();
- ti.mincount = ti.maxcount = 1;
+ ti._special = "";
+ ti._chance = 1;
+ ti._map = 0;
+ ti._shapes.clear();
+ ti._frames.clear();
+ ti._minCount = ti._maxCount = 1;
bool loadedDefault = false;
@@ -94,28 +94,28 @@ bool TreasureLoader::internalParse(Std::string desc, TreasureInfo &ti,
// pout << "internalParse: key=" << key << " val=" << val << Std::endl;
if (key == "shape") {
- if (!parseUInt32Vector(val, ti.shapes))
+ if (!parseUInt32Vector(val, ti._shapes))
return false;
} else if (key == "frame") {
- if (!parseUInt32Vector(val, ti.frames))
+ if (!parseUInt32Vector(val, ti._frames))
return false;
} else if (key == "count") {
- if (!parseUIntRange(val, ti.mincount, ti.maxcount)) {
+ if (!parseUIntRange(val, ti._minCount, ti._maxCount)) {
int x;
if (!parseInt(val, x))
return false;
- ti.mincount = ti.maxcount = x;
+ ti._minCount = ti._maxCount = x;
}
} else if (key == "chance") {
- if (!parseDouble(val, ti.chance))
+ if (!parseDouble(val, ti._chance))
return false;
} else if (key == "map") {
if (val.size() > 1 && val[0] == '!')
val[0] = '-'; // HACK: invert map for 'not this map'
- if (!parseInt(val, ti.map))
+ if (!parseInt(val, ti._map))
return false;
} else if (key == "special" && loadingDefault) {
- ti.special = val;
+ ti._special = val;
} else if (key == "type" && !loadingDefault) {
if (loadedDefault)
return false;
@@ -135,8 +135,8 @@ bool TreasureLoader::internalParse(Std::string desc, TreasureInfo &ti,
return false;
minmult = maxmult = x;
}
- ti.mincount *= minmult;
- ti.maxcount *= maxmult;
+ ti._minCount *= minmult;
+ ti._maxCount *= maxmult;
} else {
return false;
}
diff --git a/engines/ultima/ultima8/world/actors/actor.cpp b/engines/ultima/ultima8/world/actors/actor.cpp
index 50f8cfe..23f58d7 100644
--- a/engines/ultima/ultima8/world/actors/actor.cpp
+++ b/engines/ultima/ultima8/world/actors/actor.cpp
@@ -136,28 +136,28 @@ bool Actor::giveTreasure() {
// check map
int currentmap = World::get_instance()->getCurrentMap()->getNum();
- if (ti.map != 0 && ((ti.map > 0 && ti.map != currentmap) ||
- (ti.map < 0 && -ti.map == currentmap))) {
+ if (ti._map != 0 && ((ti._map > 0 && ti._map != currentmap) ||
+ (ti._map < 0 && -ti._map == currentmap))) {
continue;
}
// check chance
- if (ti.chance < 0.999 &&
- (static_cast<double>(getRandom()) / RAND_MAX) > ti.chance) {
+ if (ti._chance < 0.999 &&
+ (static_cast<double>(getRandom()) / RAND_MAX) > ti._chance) {
continue;
}
// determine count/quantity
int count;
- if (ti.mincount >= ti.maxcount)
- count = ti.mincount;
+ if (ti._minCount >= ti._maxCount)
+ count = ti._minCount;
else
- count = ti.mincount + (getRandom() % (ti.maxcount - ti.mincount));
+ count = ti._minCount + (getRandom() % (ti._maxCount - ti._minCount));
- if (!ti.special.empty()) {
- if (ti.special == "weapon") {
+ if (!ti._special.empty()) {
+ if (ti._special == "weapon") {
- // NB: this is rather biased towards weapons with low shapes...
+ // NB: this is rather biased towards weapons with low _shapes...
for (unsigned int s = 0; s < mainshapes->getCount(); ++s) {
ShapeInfo *si = mainshapes->getShapeInfo(s);
if (!si->_weaponInfo) continue;
@@ -184,7 +184,7 @@ bool Actor::giveTreasure() {
item->randomGumpLocation();
break;
}
- } else if (ti.special == "sorcfocus") {
+ } else if (ti._special == "sorcfocus") {
// CONSTANTS! (and lots of them...)
int shapeNum = 397;
int frameNum;
@@ -274,17 +274,17 @@ bool Actor::giveTreasure() {
}
} else {
- pout << "Unhandled special treasure: " << ti.special
+ pout << "Unhandled _special treasure: " << ti._special
<< Std::endl;
}
continue;
}
- // if shapes.size() == 1 and the given shape is SF_QUANTITY,
+ // if _shapes.size() == 1 and the given shape is SF_QUANTITY,
// then produce a stack of that shape (ignoring frame)
- if (ti.shapes.size() == 1) {
- uint32 shapeNum = ti.shapes[0];
+ if (ti._shapes.size() == 1) {
+ uint32 shapeNum = ti._shapes[0];
ShapeInfo *si = mainshapes->getShapeInfo(shapeNum);
if (!si) {
perr << "Trying to create treasure with an invalid shapeNum ("
@@ -307,7 +307,7 @@ bool Actor::giveTreasure() {
}
}
- if (ti.shapes.empty() || ti.frames.empty()) {
+ if (ti._shapes.empty() || ti._frames.empty()) {
perr << "No shape/frame set in treasure" << Std::endl;
continue;
}
@@ -315,12 +315,12 @@ bool Actor::giveTreasure() {
// we need to produce a number of items
for (i = 0; (int)i < count; ++i) {
// pick shape
- int n = getRandom() % ti.shapes.size();
- uint32 shapeNum = ti.shapes[n];
+ int n = getRandom() % ti._shapes.size();
+ uint32 shapeNum = ti._shapes[n];
// pick frame
- n = getRandom() % ti.frames.size();
- uint32 frameNum = ti.frames[n];
+ n = getRandom() % ti._frames.size();
+ uint32 frameNum = ti._frames[n];
ShapeInfo *si = GameData::get_instance()->getMainShapes()->
getShapeInfo(shapeNum);
@@ -481,8 +481,8 @@ Animation::Result Actor::tryAnim(Animation::Sequence anim, int dir,
if (state) {
tracker.updateState(*state);
- state->lastanim = anim;
- state->direction = dir;
+ state->_lastAnim = anim;
+ state->_direction = dir;
}
@@ -884,7 +884,7 @@ int Actor::calculateAttackDamage(uint16 other, int damage, uint16 damage_type) {
bool slayer = false;
- // special attacks
+ // _special attacks
if (damage && damage_type) {
if (damage_type & WeaponInfo::DMG_SLAYER) {
if (getRandom() % 10 == 0) {
@@ -981,13 +981,13 @@ void Actor::setInCombat() {
// kill any processes belonging to this actor
Kernel::get_instance()->killProcesses(getObjId(), 6, true);
- // perform special actions
+ // perform _special actions
ProcId castproc = callUsecodeEvent_cast(0);
CombatProcess *cp = new CombatProcess(this);
Kernel::get_instance()->addProcess(cp);
- // wait for any special actions to finish before starting to fight
+ // wait for any _special actions to finish before starting to fight
if (castproc)
cp->waitFor(castproc);
diff --git a/engines/ultima/ultima8/world/actors/animation_tracker.cpp b/engines/ultima/ultima8/world/actors/animation_tracker.cpp
index 46f21d6..f0f2c3d 100644
--- a/engines/ultima/ultima8/world/actors/animation_tracker.cpp
+++ b/engines/ultima/ultima8/world/actors/animation_tracker.cpp
@@ -71,13 +71,13 @@ bool AnimationTracker::init(Actor *actor_, Animation::Sequence action_,
_flipped = (actor_->getFlags() & Item::FLG_FLIPPED) != 0;
_firstStep = (actor_->getActorFlags() & Actor::ACT_FIRSTSTEP) != 0;
} else {
- _animAction->getAnimRange(state_->lastanim, state_->direction,
- state_->firststep, _dir, _startFrame, _endFrame);
- _flipped = state_->flipped;
- _firstStep = state_->firststep;
- _x = state_->x;
- _y = state_->y;
- _z = state_->z;
+ _animAction->getAnimRange(state_->_lastAnim, state_->_direction,
+ state_->_firstStep, _dir, _startFrame, _endFrame);
+ _flipped = state_->_flipped;
+ _firstStep = state_->_firstStep;
+ _x = state_->_x;
+ _y = state_->_y;
+ _z = state_->_z;
}
_startX = _x;
_startY = _y;
@@ -246,7 +246,7 @@ bool AnimationTracker::step() {
// (in CurrentMap maybe) that scans a small area around the given
// coordinates for a valid position (with 'must be supported' as a flag).
// Note that it should only check in directions orthogonal to the movement
- // direction (to prevent it becoming impossible to step off a ledge).
+ // _direction (to prevent it becoming impossible to step off a ledge).
// I seem to recall that the teleporter from the Upper Catacombs teleporter
// to the Upper Catacombs places you inside the floor. Using this
@@ -509,11 +509,11 @@ void AnimationTracker::checkWeaponHit() {
}
void AnimationTracker::updateState(PathfindingState &state) {
- state.x = _x;
- state.y = _y;
- state.z = _z;
- state.flipped = _flipped;
- state.firststep = _firstStep;
+ state._x = _x;
+ state._y = _y;
+ state._z = _z;
+ state._flipped = _flipped;
+ state._firstStep = _firstStep;
}
diff --git a/engines/ultima/ultima8/world/actors/pathfinder.cpp b/engines/ultima/ultima8/world/actors/pathfinder.cpp
index 4e78cd6..ff7217e 100644
--- a/engines/ultima/ultima8/world/actors/pathfinder.cpp
+++ b/engines/ultima/ultima8/world/actors/pathfinder.cpp
@@ -24,7 +24,6 @@
#include "ultima/ultima8/world/actors/pathfinder.h"
#include "ultima/ultima8/world/actors/actor.h"
#include "ultima/ultima8/world/actors/animation_tracker.h"
-
#include "ultima/ultima8/graphics/render_surface.h"
#include "ultima/ultima8/gumps/game_map_gump.h"
#include "ultima/ultima8/ultima8.h"
@@ -49,18 +48,18 @@ struct PathNode {
// NOTE: this is just to keep some statistics
static unsigned int expandednodes = 0;
-void PathfindingState::load(Actor *actor) {
- actor->getLocation(x, y, z);
- lastanim = actor->getLastAnim();
- direction = actor->getDir();
- firststep = (actor->getActorFlags() & Actor::ACT_FIRSTSTEP) != 0;
- flipped = (actor->getFlags() & Item::FLG_FLIPPED) != 0;
- combat = actor->isInCombat();
+void PathfindingState::load(Actor *_actor) {
+ _actor->getLocation(_x, _y, _z);
+ _lastAnim = _actor->getLastAnim();
+ _direction = _actor->getDir();
+ _firstStep = (_actor->getActorFlags() & Actor::ACT_FIRSTSTEP) != 0;
+ _flipped = (_actor->getFlags() & Item::FLG_FLIPPED) != 0;
+ _combat = _actor->isInCombat();
}
bool PathfindingState::checkPoint(int32 x_, int32 y_, int32 z_,
int range) {
- int distance = (x - x_) * (x - x_) + (y - y_) * (y - y_) + (z - z_) * (z - z_);
+ int distance = (_x - x_) * (_x - x_) + (_y - y_) * (_y - y_) + (_z - z_) * (_z - z_);
return distance < range * range;
}
@@ -76,27 +75,27 @@ bool PathfindingState::checkItem(Item *item, int xyRange, int zRange) {
itemYmin = itemY - itemYd;
int range = 0;
- if (x - itemX > range)
- range = x - itemX;
- if (itemXmin - x > range)
- range = itemXmin - x;
- if (y - itemY > range)
- range = y - itemY;
- if (itemYmin - y > range)
- range = itemYmin - y;
+ if (_x - itemX > range)
+ range = _x - itemX;
+ if (itemXmin - _x > range)
+ range = itemXmin - _x;
+ if (_y - itemY > range)
+ range = _y - itemY;
+ if (itemYmin - _y > range)
+ range = itemYmin - _y;
- // FIXME: check z properly
+ // FIXME: check _z properly
return (range <= xyRange);
}
-bool PathfindingState::checkHit(Actor *actor, Actor *target) {
+bool PathfindingState::checkHit(Actor *_actor, Actor *target) {
#if 0
- pout << "Trying hit in direction " << actor->getDirToItemCentre(*target) << Std::endl;
+ pout << "Trying hit in _direction " << _actor->getDirToItemCentre(*target) << Std::endl;
#endif
AnimationTracker tracker;
- if (!tracker.init(actor, Animation::attack,
- actor->getDirToItemCentre(*target), this)) {
+ if (!tracker.init(_actor, Animation::attack,
+ _actor->getDirToItemCentre(*target), this)) {
return false;
}
@@ -120,51 +119,51 @@ Pathfinder::Pathfinder() {
Pathfinder::~Pathfinder() {
#if 1
- pout << "~Pathfinder: " << nodelist.size() << " nodes, "
- << expandednodes << " expanded nodes in " << expandtime << "ms." << Std::endl;
+ pout << "~Pathfinder: " << _nodeList.size() << " _nodes, "
+ << expandednodes << " expanded _nodes in " << _expandTime << "ms." << Std::endl;
#endif
- // clean up nodes
+ // clean up _nodes
Std::list<PathNode *>::iterator iter;
- for (iter = nodelist.begin(); iter != nodelist.end(); ++iter)
+ for (iter = _nodeList.begin(); iter != _nodeList.end(); ++iter)
delete *iter;
- nodelist.clear();
+ _nodeList.clear();
}
void Pathfinder::init(Actor *actor_, PathfindingState *state) {
- actor = actor_;
+ _actor = actor_;
- actor->getFootpadWorld(actor_xd, actor_yd, actor_zd);
+ _actor->getFootpadWorld(_actorXd, _actorYd, _actorZd);
if (state)
- start = *state;
+ _start = *state;
else
- start.load(actor);
+ _start.load(_actor);
}
-void Pathfinder::setTarget(int32 x, int32 y, int32 z) {
- targetx = x;
- targety = y;
- targetz = z;
- targetitem = 0;
- hitmode = false;
+void Pathfinder::setTarget(int32 _x, int32 _y, int32 _z) {
+ _targetX = _x;
+ _targetY = _y;
+ _targetZ = _z;
+ _targetItem = 0;
+ _hitMode = false;
}
void Pathfinder::setTarget(Item *item, bool hit) {
- targetitem = item;
- while (targetitem->getParentAsContainer())
- targetitem = targetitem->getParentAsContainer();
+ _targetItem = item;
+ while (_targetItem->getParentAsContainer())
+ _targetItem = _targetItem->getParentAsContainer();
// set target to centre of item for the cost heuristic
- item->getCentre(targetx, targety, targetz);
- targetz = item->getZ();
+ item->getCentre(_targetX, _targetY, _targetZ);
+ _targetZ = item->getZ();
if (hit) {
- assert(start.combat);
- assert(p_dynamic_cast<Actor *>(targetitem));
- hitmode = true;
+ assert(_start._combat);
+ assert(p_dynamic_cast<Actor *>(_targetItem));
+ _hitMode = true;
} else {
- hitmode = false;
+ _hitMode = false;
}
}
@@ -173,13 +172,13 @@ bool Pathfinder::canReach() {
return pathfind(path);
}
-bool Pathfinder::alreadyVisited(int32 x, int32 y, int32 z) {
+bool Pathfinder::alreadyVisited(int32 _x, int32 _y, int32 _z) {
//! this may need optimization
Std::list<PathfindingState>::iterator iter;
- for (iter = visited.begin(); iter != visited.end(); ++iter)
- if (iter->checkPoint(x, y, z, 8))
+ for (iter = _visited.begin(); iter != _visited.end(); ++iter)
+ if (iter->checkPoint(_x, _y, _z, 8))
return true;
return false;
@@ -188,15 +187,15 @@ bool Pathfinder::alreadyVisited(int32 x, int32 y, int32 z) {
bool Pathfinder::checkTarget(PathNode *node) {
// TODO: these ranges are probably a bit too high,
// but otherwise it won't work properly yet -wjp
- if (targetitem) {
- if (hitmode) {
- return node->state.checkHit(actor,
- p_dynamic_cast<Actor *>(targetitem));
+ if (_targetItem) {
+ if (_hitMode) {
+ return node->state.checkHit(_actor,
+ p_dynamic_cast<Actor *>(_targetItem));
} else {
- return node->state.checkItem(targetitem, 32, 8);
+ return node->state.checkItem(_targetItem, 32, 8);
}
} else {
- return node->state.checkPoint(targetx, targety, targetz, 48);
+ return node->state.checkPoint(_targetX, _targetY, _targetZ, 48);
}
}
@@ -206,17 +205,17 @@ unsigned int Pathfinder::costHeuristic(PathNode *node) {
#if 0
double sqrddist;
- sqrddist = (targetx - node->state.x + actor_xd / 2) *
- (targetx - node->state.x + actor_xd / 2);
- sqrddist += (targety - node->state.y + actor_yd / 2) *
- (targety - node->state.y + actor_yd / 2);
+ sqrddist = (_targetX - node->state._x + _actorXd / 2) *
+ (_targetX - node->state._x + _actorXd / 2);
+ sqrddist += (_targetY - node->state._y + _actorYd / 2) *
+ (_targetY - node->state._y + _actorYd / 2);
unsigned int dist = static_cast<unsigned int>(Std::sqrt(sqrddist));
#else
// This calculates the distance to the target using only lines in
// the 8 available directions (instead of the straight line above)
- int xd = ABS(targetx - node->state.x + actor_xd / 2);
- int yd = ABS(targety - node->state.y + actor_yd / 2);
+ int xd = ABS(_targetX - node->state._x + _actorXd / 2);
+ int yd = ABS(_targetY - node->state._y + _actorYd / 2);
double m = (xd < yd) ? xd : yd;
unsigned int dist = ABS(xd - yd) + static_cast<unsigned int>(m * 1.41421356);
@@ -231,7 +230,7 @@ unsigned int Pathfinder::costHeuristic(PathNode *node) {
#else
// Weigh remaining distance more than already travelled distance,
- // to try to explore more nodes closer to the target.
+ // to try to explore more _nodes closer to the target.
node->heuristicTotalCost = 2 * cost + 3 * dist;
#endif
@@ -284,7 +283,7 @@ static void drawbox(Item *item) {
screen->DrawLine32(0xFF00FF00, x0, y0, x3, y3);
}
-static void drawdot(int32 x, int32 y, int32 z, int size, uint32 rgb) {
+static void drawdot(int32 _x, int32 _y, int32 _z, int size, uint32 rgb) {
RenderSurface *screen = Ultima8Engine::get_instance()->getRenderScreen();
int32 cx, cy, cz;
@@ -292,12 +291,12 @@ static void drawdot(int32 x, int32 y, int32 z, int size, uint32 rgb) {
Rect d;
screen->GetSurfaceDims(d);
- x -= cx;
- y -= cy;
- z -= cz;
+ _x -= cx;
+ _y -= cy;
+ _z -= cz;
int32 x0, y0;
- x0 = (d.w / 2) + (x - y) / 2;
- y0 = (d.h / 2) + (x + y) / 4 - z * 2;
+ x0 = (d.w / 2) + (_x - _y) / 2;
+ y0 = (d.h / 2) + (_x + _y) / 4 - _z * 2;
screen->Fill32(rgb, x0 - size, y0 - size, 2 * size + 1, 2 * size + 1);
}
@@ -312,18 +311,18 @@ static void drawedge(PathNode *from, PathNode *to, uint32 rgb) {
int32 x0, y0, x1, y1;
- cx = from->state.x - cx;
- cy = from->state.y - cy;
- cz = from->state.z - cz;
+ cx = from->state._x - cx;
+ cy = from->state._y - cy;
+ cz = from->state._z - cz;
x0 = (d.w / 2) + (cx - cy) / 2;
y0 = (d.h / 2) + (cx + cy) / 4 - cz * 2;
Ultima8Engine::get_instance()->getGameMapGump()->GetCameraLocation(cx, cy, cz);
- cx = to->state.x - cx;
- cy = to->state.y - cy;
- cz = to->state.z - cz;
+ cx = to->state._x - cx;
+ cy = to->state._y - cy;
+ cz = to->state._z - cz;
x1 = (d.w / 2) + (cx - cy) / 2;
y1 = (d.h / 2) + (cx + cy) / 4 - cz * 2;
@@ -339,12 +338,12 @@ static void drawpath(PathNode *to, uint32 rgb, bool done) {
drawedge(n1, n2, rgb);
if (done && n1 == to)
- drawdot(n1->state.x, n1->state.y, n1->state.z, 2, 0xFFFF0000);
+ drawdot(n1->state._x, n1->state._y, n1->state._z, 2, 0xFFFF0000);
else
- drawdot(n1->state.x, n1->state.y, n1->state.z, 1, 0xFFFFFFFF);
+ drawdot(n1->state._x, n1->state._y, n1->state._z, 1, 0xFFFFFFFF);
- drawdot(n2->state.x, n2->state.y, n2->state.z, 2, 0xFFFFFFFF);
+ drawdot(n2->state._x, n2->state._y, n2->state._z, 2, 0xFFFFFFFF);
n1 = n2;
n2 = n1->parent;
@@ -356,7 +355,7 @@ static void drawpath(PathNode *to, uint32 rgb, bool done) {
void Pathfinder::newNode(PathNode *oldnode, PathfindingState &state,
unsigned int steps) {
PathNode *newnode = new PathNode();
- nodelist.push_back(newnode); // for garbage collection
+ _nodeList.push_back(newnode); // for garbage collection
newnode->state = state;
newnode->parent = oldnode;
newnode->depth = oldnode->depth + 1;
@@ -364,12 +363,12 @@ void Pathfinder::newNode(PathNode *oldnode, PathfindingState &state,
double sqrddist;
- sqrddist = ((newnode->state.x - oldnode->state.x) *
- (newnode->state.x - oldnode->state.x));
- sqrddist += ((newnode->state.y - oldnode->state.y) *
- (newnode->state.y - oldnode->state.y));
- sqrddist += ((newnode->state.z - oldnode->state.z) *
- (newnode->state.z - oldnode->state.z));
+ sqrddist = ((newnode->state._x - oldnode->state._x) *
+ (newnode->state._x - oldnode->state._x));
+ sqrddist += ((newnode->state._y - oldnode->state._y) *
+ (newnode->state._y - oldnode->state._y));
+ sqrddist += ((newnode->state._z - oldnode->state._z) *
+ (newnode->state._z - oldnode->state._z));
unsigned int dist;
dist = static_cast<unsigned int>(Std::sqrt(sqrddist));
@@ -377,7 +376,7 @@ void Pathfinder::newNode(PathNode *oldnode, PathfindingState &state,
int turn = 0;
if (oldnode->depth > 0) {
- turn = state.direction - oldnode->state.direction;
+ turn = state._direction - oldnode->state._direction;
if (turn < 0) turn = -turn;
if (turn > 4) turn = 8 - turn;
}
@@ -391,20 +390,20 @@ void Pathfinder::newNode(PathNode *oldnode, PathfindingState &state,
costHeuristic(newnode);
#if 0
- perr << "trying dir " << state.direction;
+ perr << "trying dir " << state._direction;
if (steps > 0) {
perr << ", " << steps << " steps";
}
perr << " from ("
- << oldnode->state.x << "," << oldnode->state.y << ") to ("
- << newnode->state.x << "," << newnode->state.y
+ << oldnode->state._x << "," << oldnode->state._y << ") to ("
+ << newnode->state._x << "," << newnode->state._y
<< "), cost = " << newnode->cost << ", heurtotcost = "
<< newnode->heuristicTotalCost << Std::endl;
#endif
#ifdef DEBUG
- if (actor->getObjId() == visualdebug_actor) {
+ if (_actor->getObjId() == visualdebug_actor) {
RenderSurface *screen = Ultima8Engine::get_instance()->getRenderScreen();
screen->BeginPainting();
drawpath(newnode, 0xFFFFFF00, done);
@@ -418,7 +417,7 @@ void Pathfinder::newNode(PathNode *oldnode, PathfindingState &state,
}
#endif
- nodes.push(newnode);
+ _nodes.push(newnode);
}
void Pathfinder::expandNode(PathNode *node) {
@@ -427,40 +426,40 @@ void Pathfinder::expandNode(PathNode *node) {
AnimationTracker tracker;
expandednodes++;
- if (actor->isInCombat())
+ if (_actor->isInCombat())
walkanim = Animation::advance;
// try walking in all 8 directions
for (uint32 dir = 0; dir < 8; ++dir) {
state = node->state;
- state.lastanim = walkanim;
- state.direction = dir;
- state.combat = actor->isInCombat();
+ state._lastAnim = walkanim;
+ state._direction = dir;
+ state._combat = _actor->isInCombat();
uint32 steps = 0, beststeps = 0;
int bestsqdist;
- bestsqdist = (targetx - node->state.x + actor_xd / 2) *
- (targetx - node->state.x + actor_xd / 2);
- bestsqdist += (targety - node->state.y + actor_yd / 2) *
- (targety - node->state.y + actor_yd / 2);
+ bestsqdist = (_targetX - node->state._x + _actorXd / 2) *
+ (_targetX - node->state._x + _actorXd / 2);
+ bestsqdist += (_targetY - node->state._y + _actorYd / 2) *
+ (_targetY - node->state._y + _actorYd / 2);
- if (!tracker.init(actor, walkanim, dir, &state)) continue;
+ if (!tracker.init(_actor, walkanim, dir, &state)) continue;
- // determine how far the actor will travel if the animation runs to completion
+ // determine how far the _actor will travel if the animation runs to completion
int32 max_endx, max_endy;
tracker.evaluateMaxAnimTravel(max_endx, max_endy, dir);
- if (alreadyVisited(max_endx, max_endy, state.z)) continue;
+ if (alreadyVisited(max_endx, max_endy, state._z)) continue;
int sqrddist;
- int x_travel = ABS(max_endx - state.x);
+ int x_travel = ABS(max_endx - state._x);
int xy_maxtravel = x_travel; // don't have the max(a,b) macro...
- int y_travel = ABS(max_endy - state.y);
+ int y_travel = ABS(max_endy - state._y);
if (y_travel > xy_maxtravel) xy_maxtravel = y_travel;
sqrddist = x_travel * x_travel + y_travel * y_travel;
if (sqrddist > 400) {
- // range is greater than 20; see if a node has been visited at range 10
- if (alreadyVisited(state.x + x_travel * 10 / xy_maxtravel,
- state.y + y_travel * 10 / xy_maxtravel,
- state.z)) {
+ // range is greater than 20; see if a node has been _visited at range 10
+ if (alreadyVisited(state._x + x_travel * 10 / xy_maxtravel,
+ state._y + y_travel * 10 / xy_maxtravel,
+ state._z)) {
continue;
}
}
@@ -468,10 +467,10 @@ void Pathfinder::expandNode(PathNode *node) {
steps++;
tracker.updateState(state);
- sqrddist = (targetx - state.x + actor_xd / 2) *
- (targetx - state.x + actor_xd / 2);
- sqrddist += (targety - state.y + actor_yd / 2) *
- (targety - state.y + actor_yd / 2);
+ sqrddist = (_targetX - state._x + _actorXd / 2) *
+ (_targetX - state._x + _actorXd / 2);
+ sqrddist += (_targetY - state._y + _actorYd / 2) *
+ (_targetY - state._y + _actorYd / 2);
if (sqrddist < bestsqdist) {
bestsqdist = sqrddist;
@@ -482,45 +481,45 @@ void Pathfinder::expandNode(PathNode *node) {
if (tracker.isDone()) {
tracker.updateState(state);
- if (!alreadyVisited(state.x, state.y, state.z)) {
+ if (!alreadyVisited(state._x, state._y, state._z)) {
newNode(node, state, 0);
- visited.push_back(state);
+ _visited.push_back(state);
}
} else {
- // an obstruction was encountered, so generate a visited node to block
+ // an obstruction was encountered, so generate a _visited node to block
// future evaluation at the endpoint.
- visited.push_back(state);
+ _visited.push_back(state);
}
// TODO: maybe only allow partial steps close to target?
if (beststeps != 0 && (beststeps != steps ||
- (!tracker.isDone() && targetitem))) {
+ (!tracker.isDone() && _targetItem))) {
newNode(node, closeststate, beststeps);
- visited.push_back(closeststate);
+ _visited.push_back(closeststate);
}
}
}
bool Pathfinder::pathfind(Std::vector<PathfindingAction> &path) {
#if 0
- pout << "Actor " << actor->getObjId();
+ pout << "Actor " << _actor->getObjId();
- if (targetitem) {
+ if (_targetItem) {
pout << " pathfinding to item: ";
- targetitem->dumpInfo();
+ _targetItem->dumpInfo();
} else {
- pout << " pathfinding to (" << targetx << "," << targety << "," << targetz << ")" << Std::endl;
+ pout << " pathfinding to (" << _targetX << "," << _targetY << "," << _targetZ << ")" << Std::endl;
}
#endif
#ifdef DEBUG
- if (actor->getObjId() == visualdebug_actor) {
+ if (_actor->getObjId() == visualdebug_actor) {
RenderSurface *screen = Ultima8Engine::get_instance()->getRenderScreen();
screen->BeginPainting();
- if (targetitem)
- drawbox(targetitem);
+ if (_targetItem)
+ drawbox(_targetItem);
else
- drawdot(targetx, targety, targetz, 2, 0xFF0000FF);
+ drawdot(_targetX, _targetY, _targetZ, 2, 0xFF0000FF);
screen->EndPainting();
}
#endif
@@ -529,13 +528,13 @@ bool Pathfinder::pathfind(Std::vector<PathfindingAction> &path) {
path.clear();
PathNode *startnode = new PathNode();
- startnode->state = start;
+ startnode->state = _start;
startnode->cost = 0;
startnode->parent = 0;
startnode->depth = 0;
startnode->stepsfromparent = 0;
- nodelist.push_back(startnode);
- nodes.push(startnode);
+ _nodeList.push_back(startnode);
+ _nodes.push(startnode);
unsigned int expandedNodes = 0;
const unsigned int NODELIMIT_MIN = 30; //! constant
@@ -543,14 +542,14 @@ bool Pathfinder::pathfind(Std::vector<PathfindingAction> &path) {
bool found = false;
uint32 starttime = g_system->getMillis();
- while (expandedNodes < NODELIMIT_MAX && !nodes.empty() && !found) {
- PathNode *node = nodes.top();
- nodes.pop();
+ while (expandedNodes < NODELIMIT_MAX && !_nodes.empty() && !found) {
+ PathNode *node = _nodes.top();
+ _nodes.pop();
#if 0
- pout << "Trying node: (" << node->state.x << "," << node->state.y
- << "," << node->state.z << ") target=(" << targetx << ","
- << targety << "," << targetz << ")" << Std::endl;
+ pout << "Trying node: (" << node->state._x << "," << node->state._y
+ << "," << node->state._z << ") target=(" << _targetX << ","
+ << _targetY << "," << _targetZ << ")" << Std::endl;
#endif
if (checkTarget(node)) {
@@ -572,16 +571,16 @@ bool Pathfinder::pathfind(Std::vector<PathfindingAction> &path) {
if (length > 0) length++; // add space for final 'stand' action
path.resize(length);
- // now backtrack through the nodes to assemble the final animation
+ // now backtrack through the _nodes to assemble the final animation
while (node->parent) {
PathfindingAction action;
- action.action = node->state.lastanim;
- action.direction = node->state.direction;
- action.steps = node->stepsfromparent;
+ action._action = node->state._lastAnim;
+ action._direction = node->state._direction;
+ action._steps = node->stepsfromparent;
path[--i] = action;
#if 0
- pout << "anim = " << node->state.lastanim << ", dir = "
- << node->state.direction << ", steps = "
+ pout << "anim = " << node->state._lastAnim << ", dir = "
+ << node->state._direction << ", steps = "
<< node->stepsfromparent << Std::endl;
#endif
@@ -592,14 +591,14 @@ bool Pathfinder::pathfind(Std::vector<PathfindingAction> &path) {
}
if (length) {
- if (node->state.combat)
- path[length - 1].action = Animation::combatStand;
+ if (node->state._combat)
+ path[length - 1]._action = Animation::combatStand;
else
- path[length - 1].action = Animation::stand;
- path[length - 1].direction = path[length - 2].direction;
+ path[length - 1]._action = Animation::stand;
+ path[length - 1]._direction = path[length - 2]._direction;
}
- expandtime = g_system->getMillis() - starttime;
+ _expandTime = g_system->getMillis() - starttime;
return true;
}
@@ -612,13 +611,13 @@ bool Pathfinder::pathfind(Std::vector<PathfindingAction> &path) {
}
}
- expandtime = g_system->getMillis() - starttime;
+ _expandTime = g_system->getMillis() - starttime;
#if 0
static int32 pfcalls = 0;
static int32 pftotaltime = 0;
pfcalls++;
- pftotaltime += expandtime;
+ pftotaltime += _expandTime;
pout << "maxout average = " << (pftotaltime / pfcalls) << "ms." << Std::endl;
#endif
@@ -639,7 +638,7 @@ void Pathfinder::ConCmd_visualDebug(const Console::ArgvType &argv) {
pout << "Pathfinder: stopped visual tracing" << Std::endl;
} else {
visualdebug_actor = (uint16)p;
- pout << "Pathfinder: visually tracing actor " << visualdebug_actor << Std::endl;
+ pout << "Pathfinder: visually tracing _actor " << visualdebug_actor << Std::endl;
}
}
#endif
diff --git a/engines/ultima/ultima8/world/actors/pathfinder.h b/engines/ultima/ultima8/world/actors/pathfinder.h
index 9d649a6..b3a3da2 100644
--- a/engines/ultima/ultima8/world/actors/pathfinder.h
+++ b/engines/ultima/ultima8/world/actors/pathfinder.h
@@ -34,12 +34,12 @@ class Actor;
class Item;
struct PathfindingState {
- int32 x, y, z;
- Animation::Sequence lastanim;
- uint32 direction;
- bool flipped;
- bool firststep;
- bool combat;
+ int32 _x, _y, _z;
+ Animation::Sequence _lastAnim;
+ uint32 _direction;
+ bool _flipped;
+ bool _firstStep;
+ bool _combat;
void load(Actor *actor);
bool checkPoint(int32 x_, int32 y_, int32 z_, int range);
@@ -48,9 +48,9 @@ struct PathfindingState {
};
struct PathfindingAction {
- Animation::Sequence action;
- uint32 direction;
- uint32 steps;
+ Animation::Sequence _action;
+ uint32 _direction;
+ uint32 _steps;
};
struct PathNode;
@@ -83,19 +83,19 @@ public:
protected:
- PathfindingState start;
- Actor *actor;
- int32 targetx, targety, targetz;
- Item *targetitem;
- bool hitmode;
- int32 expandtime;
+ PathfindingState _start;
+ Actor *_actor;
+ int32 _targetX, _targetY, _targetZ;
+ Item *_targetItem;
+ bool _hitMode;
+ int32 _expandTime;
- int32 actor_xd, actor_yd, actor_zd;
+ int32 _actorXd, _actorYd, _actorZd;
- Std::list<PathfindingState> visited;
- Std::priority_queue<PathNode *, Std::vector<PathNode *>, PathNodeCmp> nodes;
+ Std::list<PathfindingState> _visited;
+ Std::priority_queue<PathNode *, Std::vector<PathNode *>, PathNodeCmp> _nodes;
- Std::list<PathNode *> nodelist;
+ Std::list<PathNode *> _nodeList;
bool alreadyVisited(int32 x, int32 y, int32 z);
void newNode(PathNode *oldnode, PathfindingState &state, unsigned int steps);
diff --git a/engines/ultima/ultima8/world/actors/pathfinder_process.cpp b/engines/ultima/ultima8/world/actors/pathfinder_process.cpp
index 0beabff..7091984 100644
--- a/engines/ultima/ultima8/world/actors/pathfinder_process.cpp
+++ b/engines/ultima/ultima8/world/actors/pathfinder_process.cpp
@@ -58,22 +58,22 @@ PathfinderProcess::PathfinderProcess(Actor *actor_, ObjId item_, bool hit) {
return;
}
- currentstep = 0;
- targetitem = item_;
- hitmode = hit;
- assert(targetitem);
+ _currentStep = 0;
+ _targetItem = item_;
+ _hitMode = hit;
+ assert(_targetItem);
- item->getLocation(targetx, targety, targetz);
+ item->getLocation(_targetX, _targetY, _targetZ);
Pathfinder pf;
pf.init(actor_);
pf.setTarget(item, hit);
- bool ok = pf.pathfind(path);
+ bool ok = pf.pathfind(_path);
if (!ok) {
perr << "PathfinderProcess: actor " << _itemNum
- << " failed to find path" << Std::endl;
+ << " failed to find _path" << Std::endl;
// can't get there...
_result = PATH_FAILED;
terminateDeferred();
@@ -89,22 +89,22 @@ PathfinderProcess::PathfinderProcess(Actor *actor_,
assert(actor_);
_itemNum = actor_->getObjId();
- targetx = x;
- targety = y;
- targetz = z;
- targetitem = 0;
+ _targetX = x;
+ _targetY = y;
+ _targetZ = z;
+ _targetItem = 0;
- currentstep = 0;
+ _currentStep = 0;
Pathfinder pf;
pf.init(actor_);
- pf.setTarget(targetx, targety, targetz);
+ pf.setTarget(_targetX, _targetY, _targetZ);
- bool ok = pf.pathfind(path);
+ bool ok = pf.pathfind(_path);
if (!ok) {
perr << "PathfinderProcess: actor " << _itemNum
- << " failed to find path" << Std::endl;
+ << " failed to find _path" << Std::endl;
// can't get there...
_result = PATH_FAILED;
terminateDeferred();
@@ -139,9 +139,9 @@ void PathfinderProcess::run() {
bool ok = true;
- if (targetitem) {
+ if (_targetItem) {
int32 curx, cury, curz;
- Item *item = getItem(targetitem);
+ Item *item = getItem(_targetItem);
if (!item) {
perr << "PathfinderProcess: target missing" << Std::endl;
_result = PATH_FAILED;
@@ -150,14 +150,14 @@ void PathfinderProcess::run() {
}
item->getLocation(curx, cury, curz);
- if (ABS(curx - targetx) >= 32 || ABS(cury - targety) >= 32 ||
- ABS(curz - targetz) >= 8) {
+ if (ABS(curx - _targetX) >= 32 || ABS(cury - _targetY) >= 32 ||
+ ABS(curz - _targetZ) >= 8) {
// target moved
ok = false;
}
}
- if (ok && currentstep >= path.size()) {
+ if (ok && _currentStep >= _path.size()) {
// done
#if 0
pout << "PathfinderProcess: done" << Std::endl;
@@ -176,49 +176,49 @@ void PathfinderProcess::run() {
// if actor is still animating for whatever reason, wait until he stopped
// FIXME: this should happen before the pathfinder is actually called,
// since the running animation may move the actor, which could break
- // the found path.
+ // the found _path.
if (actor->getActorFlags() & Actor::ACT_ANIMLOCK) {
perr << "PathfinderProcess: ANIMLOCK, waiting" << Std::endl;
return;
}
if (ok) {
- ok = actor->tryAnim(path[currentstep].action,
- path[currentstep].direction,
- path[currentstep].steps) == Animation::SUCCESS;
+ ok = actor->tryAnim(_path[_currentStep]._action,
+ _path[_currentStep]._direction,
+ _path[_currentStep]._steps) == Animation::SUCCESS;
}
if (!ok) {
#if 0
- pout << "PathfinderProcess: recalculating path" << Std::endl;
+ pout << "PathfinderProcess: recalculating _path" << Std::endl;
#endif
- // need to redetermine path
+ // need to redetermine _path
ok = true;
Pathfinder pf;
pf.init(actor);
- if (targetitem) {
- Item *item = getItem(targetitem);
+ if (_targetItem) {
+ Item *item = getItem(_targetItem);
if (!item)
ok = false;
else {
- if (hitmode && !actor->isInCombat()) {
+ if (_hitMode && !actor->isInCombat()) {
// Actor exited combat mode
- hitmode = false;
+ _hitMode = false;
}
- pf.setTarget(item, hitmode);
- item->getLocation(targetx, targety, targetz);
+ pf.setTarget(item, _hitMode);
+ item->getLocation(_targetX, _targetY, _targetZ);
}
} else {
- pf.setTarget(targetx, targety, targetz);
+ pf.setTarget(_targetX, _targetY, _targetZ);
}
if (ok)
- ok = pf.pathfind(path);
+ ok = pf.pathfind(_path);
- currentstep = 0;
+ _currentStep = 0;
if (!ok) {
perr << "PathfinderProcess: actor " << _itemNum
- << " failed to find path" << Std::endl;
+ << " failed to find _path" << Std::endl;
// can't get there anymore
_result = PATH_FAILED;
terminate();
@@ -226,7 +226,7 @@ void PathfinderProcess::run() {
}
}
- if (currentstep >= path.size()) {
+ if (_currentStep >= _path.size()) {
#if 0
pout << "PathfinderProcess: done" << Std::endl;
#endif
@@ -236,15 +236,15 @@ void PathfinderProcess::run() {
return;
}
- uint16 animpid = actor->doAnim(path[currentstep].action,
- path[currentstep].direction,
- path[currentstep].steps);
+ uint16 animpid = actor->doAnim(_path[_currentStep]._action,
+ _path[_currentStep]._direction,
+ _path[_currentStep]._steps);
#if 0
pout << "PathfinderProcess(" << getPid() << "): taking step "
- << path[currentstep].action << "," << path[currentstep].direction
+ << _path[_currentStep].action << "," << _path[_currentStep].direction
<< " (animpid=" << animpid << ")" << Std::endl;
#endif
- currentstep++;
+ _currentStep++;
waitFor(animpid);
}
@@ -252,35 +252,35 @@ void PathfinderProcess::run() {
void PathfinderProcess::saveData(ODataSource *ods) {
Process::saveData(ods);
- ods->write2(targetitem);
- ods->write2(static_cast<uint16>(targetx));
- ods->write2(static_cast<uint16>(targety));
- ods->write2(static_cast<uint16>(targetz));
- ods->write1(hitmode ? 1 : 0);
- ods->write2(static_cast<uint16>(currentstep));
-
- ods->write2(static_cast<uint16>(path.size()));
- for (unsigned int i = 0; i < path.size(); ++i) {
- ods->write2(static_cast<uint16>(path[i].action));
- ods->write2(static_cast<uint16>(path[i].direction));
+ ods->write2(_targetItem);
+ ods->write2(static_cast<uint16>(_targetX));
+ ods->write2(static_cast<uint16>(_targetY));
+ ods->write2(static_cast<uint16>(_targetZ));
+ ods->write1(_hitMode ? 1 : 0);
+ ods->write2(static_cast<uint16>(_currentStep));
+
+ ods->write2(static_cast<uint16>(_path.size()));
+ for (unsigned int i = 0; i < _path.size(); ++i) {
+ ods->write2(static_cast<uint16>(_path[i]._action));
+ ods->write2(static_cast<uint16>(_path[i]._direction));
}
}
bool PathfinderProcess::loadData(IDataSource *ids, uint32 version) {
if (!Process::loadData(ids, version)) return false;
- targetitem = ids->read2();
- targetx = ids->read2();
- targety = ids->read2();
- targetz = ids->read2();
- hitmode = (ids->read1() != 0);
- currentstep = ids->read2();
+ _targetItem = ids->read2();
+ _targetX = ids->read2();
+ _targetY = ids->read2();
+ _targetZ = ids->read2();
+ _hitMode = (ids->read1() != 0);
+ _currentStep = ids->read2();
unsigned int pathsize = ids->read2();
- path.resize(pathsize);
+ _path.resize(pathsize);
for (unsigned int i = 0; i < pathsize; ++i) {
- path[i].action = static_cast<Animation::Sequence>(ids->read2());
- path[i].direction = ids->read2();
+ _path[i]._action = static_cast<Animation::Sequence>(ids->read2());
+ _path[i]._direction = ids->read2();
}
return true;
diff --git a/engines/ultima/ultima8/world/actors/pathfinder_process.h b/engines/ultima/ultima8/world/actors/pathfinder_process.h
index 32485cd..a26f5ef 100644
--- a/engines/ultima/ultima8/world/actors/pathfinder_process.h
+++ b/engines/ultima/ultima8/world/actors/pathfinder_process.h
@@ -51,12 +51,12 @@ public:
protected:
void saveData(ODataSource *ods) override;
- int32 targetx, targety, targetz;
- ObjId targetitem;
- bool hitmode;
+ int32 _targetX, _targetY, _targetZ;
+ ObjId _targetItem;
+ bool _hitMode;
- Std::vector<PathfindingAction> path;
- unsigned int currentstep;
+ Std::vector<PathfindingAction> _path;
+ unsigned int _currentStep;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/actors/quick_avatar_mover_process.cpp b/engines/ultima/ultima8/world/actors/quick_avatar_mover_process.cpp
index 98b18dc..210345f 100644
--- a/engines/ultima/ultima8/world/actors/quick_avatar_mover_process.cpp
+++ b/engines/ultima/ultima8/world/actors/quick_avatar_mover_process.cpp
@@ -22,7 +22,6 @@
#include "ultima/ultima8/misc/pent_include.h"
#include "ultima/ultima8/world/actors/quick_avatar_mover_process.h"
-
#include "ultima/ultima8/world/actors/main_actor.h"
#include "ultima/ultima8/world/world.h"
#include "ultima/ultima8/world/current_map.h"
@@ -31,7 +30,6 @@
#include "ultima/ultima8/graphics/shape_info.h"
#include "ultima/ultima8/world/get_object.h"
#include "ultima/ultima8/world/actors/avatar_mover_process.h"
-
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/filesys/odata_source.h"
@@ -42,16 +40,16 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(QuickAvatarMoverProcess, Process)
ProcId QuickAvatarMoverProcess::amp[6] = { 0, 0, 0, 0, 0, 0 };
-bool QuickAvatarMoverProcess::clipping = false;
-bool QuickAvatarMoverProcess::quarter = false;
+bool QuickAvatarMoverProcess::_clipping = false;
+bool QuickAvatarMoverProcess::_quarter = false;
-QuickAvatarMoverProcess::QuickAvatarMoverProcess() : Process(1), dx(0), dy(0), dz(0), dir(0) {
+QuickAvatarMoverProcess::QuickAvatarMoverProcess() : Process(1), _dx(0), _dy(0), _dz(0), _dir(0) {
}
-QuickAvatarMoverProcess::QuickAvatarMoverProcess(int x, int y, int z, int _dir) : Process(1), dx(x), dy(y), dz(z), dir(_dir) {
- QuickAvatarMoverProcess::terminateMover(dir);
- assert(dir < 6);
- amp[dir] = getPid();
+QuickAvatarMoverProcess::QuickAvatarMoverProcess(int x, int y, int z, int _dir) : Process(1), _dx(x), _dy(y), _dz(z), _dir(_dir) {
+ QuickAvatarMoverProcess::terminateMover(_dir);
+ assert(_dir < 6);
+ amp[_dir] = getPid();
}
QuickAvatarMoverProcess::~QuickAvatarMoverProcess() {
@@ -71,19 +69,19 @@ void QuickAvatarMoverProcess::run() {
CurrentMap *cm = World::get_instance()->getCurrentMap();
- int32 dxv = this->dx;
- int32 dyv = this->dy;
- int32 dzv = this->dz;
+ int32 dxv = this->_dx;
+ int32 dyv = this->_dy;
+ int32 dzv = this->_dz;
for (int j = 0; j < 3; j++) {
- dxv = this->dx;
- dyv = this->dy;
- dzv = this->dz;
+ dxv = this->_dx;
+ dyv = this->_dy;
+ dzv = this->_dz;
if (j == 1) dxv = 0;
else if (j == 2) dyv = 0;
- if (quarter) {
+ if (_quarter) {
dxv /= 4;
dyv /= 4;
dzv /= 4;
@@ -94,8 +92,8 @@ void QuickAvatarMoverProcess::run() {
while (dxv || dyv || dzv) {
uint32 shapeFlags = avatar->getShapeInfo()->_flags;
- if (!clipping || cm->isValidPosition(x + dxv, y + dyv, z + dzv, ixd, iyd, izd, _flags, 1, 0, 0)) {
- if (clipping && !dzv) {
+ if (!_clipping || cm->isValidPosition(x + dxv, y + dyv, z + dzv, ixd, iyd, izd, _flags, 1, 0, 0)) {
+ if (_clipping && !dzv) {
if (cm->isValidPosition(x + dxv, y + dyv, z - 8, ixd, iyd, izd, _flags, 1, 0, 0) &&
!cm->isValidPosition(x, y, z - 8, ixd, iyd, izd, _flags, 1, 0, 0)) {
dzv = -8;
@@ -134,7 +132,7 @@ void QuickAvatarMoverProcess::run() {
void QuickAvatarMoverProcess::terminate() {
Process::terminate();
- amp[dir] = 0;
+ amp[_dir] = 0;
}
void QuickAvatarMoverProcess::terminateMover(int _dir) {
@@ -162,7 +160,7 @@ void QuickAvatarMoverProcess::startMover(int x, int y, int z, int _dir) {
void QuickAvatarMoverProcess::saveData(ODataSource *ods) {
Process::saveData(ods);
- ods->write4(dir);
+ ods->write4(_dir);
// don't save more information. We plan to terminate upon load
}
@@ -170,9 +168,9 @@ bool QuickAvatarMoverProcess::loadData(IDataSource *ids, uint32 version) {
if (!Process::loadData(ids, version)) return false;
// small safety precaution
- dir = ids->read4();
- if (dir < 6)
- amp[dir] = 0;
+ _dir = ids->read4();
+ if (_dir < 6)
+ amp[_dir] = 0;
else
return false;
@@ -241,7 +239,7 @@ void QuickAvatarMoverProcess::ConCmd_toggleQuarterSpeed(const Console::ArgvType
void QuickAvatarMoverProcess::ConCmd_toggleClipping(const Console::ArgvType &argv) {
if (!Ultima8Engine::get_instance()->areCheatsEnabled()) return;
QuickAvatarMoverProcess::toggleClipping();
- pout << "QuickAvatarMoverProcess::clipping = " << QuickAvatarMoverProcess::isClipping() << Std::endl;
+ pout << "QuickAvatarMoverProcess::_clipping = " << QuickAvatarMoverProcess::isClipping() << Std::endl;
}
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/actors/quick_avatar_mover_process.h b/engines/ultima/ultima8/world/actors/quick_avatar_mover_process.h
index 548aa3f..34082ec 100644
--- a/engines/ultima/ultima8/world/actors/quick_avatar_mover_process.h
+++ b/engines/ultima/ultima8/world/actors/quick_avatar_mover_process.h
@@ -42,16 +42,16 @@ public:
void terminate() override;
static bool isQuarterSpeed() {
- return quarter;
+ return _quarter;
}
static bool isClipping() {
- return clipping;
+ return _clipping;
}
static void setQuarterSpeed(bool q) {
- quarter = q;
+ _quarter = q;
}
static void toggleClipping() {
- clipping = !clipping;
+ _clipping = !_clipping;
}
static void terminateMover(int _dir);
@@ -78,10 +78,10 @@ public:
protected:
void saveData(ODataSource *ods) override;
- int dx, dy, dz, dir;
+ int _dx, _dy, _dz, _dir;
static ProcId amp[6];
- static bool clipping;
- static bool quarter;
+ static bool _clipping;
+ static bool _quarter;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/actors/scheduler_process.cpp b/engines/ultima/ultima8/world/actors/scheduler_process.cpp
index 7f28b12..0e716b1 100644
--- a/engines/ultima/ultima8/world/actors/scheduler_process.cpp
+++ b/engines/ultima/ultima8/world/actors/scheduler_process.cpp
@@ -37,16 +37,16 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(SchedulerProcess, Process)
SchedulerProcess::SchedulerProcess() : Process() {
- lastRun = 0;
- nextActor = 0;
+ _lastRun = 0;
+ _nextActor = 0;
_type = 0x245; // CONSTANT!
}
void SchedulerProcess::run() {
- if (nextActor != 0) {
+ if (_nextActor != 0) {
// doing a scheduling run at the moment
- Actor *a = getActor(nextActor);
+ Actor *a = getActor(_nextActor);
if (a) {
// CHECKME: is this the right time to pass? CONSTANT
uint32 stime = Ultima8Engine::get_instance()->getGameTimeInSeconds() / 60;
@@ -54,9 +54,9 @@ void SchedulerProcess::run() {
if (schedpid) waitFor(schedpid);
}
- nextActor++;
- if (nextActor == 256) { // CONSTANT
- nextActor = 0; // done
+ _nextActor++;
+ if (_nextActor == 256) { // CONSTANT
+ _nextActor = 0; // done
#if 0
pout << "Scheduler: finished run at "
<< Kernel::get_instance()->getFrameNum() << Std::endl;
@@ -69,10 +69,10 @@ void SchedulerProcess::run() {
// CONSTANT!
uint32 currenthour = Ultima8Engine::get_instance()->getGameTimeInSeconds() / 900;
- if (currenthour > lastRun) {
+ if (currenthour > _lastRun) {
// schedule a new scheduling run
- lastRun = currenthour;
- nextActor = 1;
+ _lastRun = currenthour;
+ _nextActor = 1;
#if 0
pout << "Scheduler: " << Kernel::get_instance()->getFrameNum()
<< Std::endl;
@@ -83,15 +83,15 @@ void SchedulerProcess::run() {
void SchedulerProcess::saveData(ODataSource *ods) {
Process::saveData(ods);
- ods->write4(lastRun);
- ods->write2(nextActor);
+ ods->write4(_lastRun);
+ ods->write2(_nextActor);
}
bool SchedulerProcess::loadData(IDataSource *ids, uint32 version) {
if (!Process::loadData(ids, version)) return false;
- lastRun = ids->read4();
- nextActor = ids->read2();
+ _lastRun = ids->read4();
+ _nextActor = ids->read2();
return true;
}
diff --git a/engines/ultima/ultima8/world/actors/scheduler_process.h b/engines/ultima/ultima8/world/actors/scheduler_process.h
index 4e49230..fb4ff84 100644
--- a/engines/ultima/ultima8/world/actors/scheduler_process.h
+++ b/engines/ultima/ultima8/world/actors/scheduler_process.h
@@ -42,8 +42,8 @@ public:
protected:
void saveData(ODataSource *ods) override;
- uint32 lastRun;
- uint16 nextActor;
+ uint32 _lastRun;
+ uint16 _nextActor;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/actors/targeted_anim_process.cpp b/engines/ultima/ultima8/world/actors/targeted_anim_process.cpp
index 28e31e4..8087d15 100644
--- a/engines/ultima/ultima8/world/actors/targeted_anim_process.cpp
+++ b/engines/ultima/ultima8/world/actors/targeted_anim_process.cpp
@@ -39,16 +39,16 @@ TargetedAnimProcess::TargetedAnimProcess() : ActorAnimProcess() {
}
TargetedAnimProcess::TargetedAnimProcess(Actor *actor_, Animation::Sequence action_, uint32 dir_, int32 coords[3]) : ActorAnimProcess(actor_, action_, dir_) {
- x = coords[0];
- y = coords[1];
- z = coords[2];
+ _x = coords[0];
+ _y = coords[1];
+ _z = coords[2];
}
bool TargetedAnimProcess::init() {
if (!ActorAnimProcess::init())
return false;
- _tracker->setTargetedMode(x, y, z);
+ _tracker->setTargetedMode(_x, _y, _z);
return true;
}
@@ -56,18 +56,18 @@ bool TargetedAnimProcess::init() {
void TargetedAnimProcess::saveData(ODataSource *ods) {
ActorAnimProcess::saveData(ods);
- ods->write4(static_cast<uint32>(x));
- ods->write4(static_cast<uint32>(y));
- ods->write4(static_cast<uint32>(z));
+ ods->write4(static_cast<uint32>(_x));
+ ods->write4(static_cast<uint32>(_y));
+ ods->write4(static_cast<uint32>(_z));
}
bool TargetedAnimProcess::loadData(IDataSource *ids, uint32 version) {
if (!ActorAnimProcess::loadData(ids, version)) return false;
- x = ids->read4();
- y = ids->read4();
- z = ids->read4();
+ _x = ids->read4();
+ _y = ids->read4();
+ _z = ids->read4();
return true;
}
diff --git a/engines/ultima/ultima8/world/actors/targeted_anim_process.h b/engines/ultima/ultima8/world/actors/targeted_anim_process.h
index 72bb016..bfc28f7 100644
--- a/engines/ultima/ultima8/world/actors/targeted_anim_process.h
+++ b/engines/ultima/ultima8/world/actors/targeted_anim_process.h
@@ -46,7 +46,7 @@ protected:
bool init() override;
- int32 x, y, z;
+ int32 _x, _y, _z;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/actors/teleport_to_egg_process.cpp b/engines/ultima/ultima8/world/actors/teleport_to_egg_process.cpp
index 4e28824..da1ce96 100644
--- a/engines/ultima/ultima8/world/actors/teleport_to_egg_process.cpp
+++ b/engines/ultima/ultima8/world/actors/teleport_to_egg_process.cpp
@@ -39,8 +39,8 @@ TeleportToEggProcess::TeleportToEggProcess() : Process() {
}
-TeleportToEggProcess::TeleportToEggProcess(int mapnum_, int teleport_id_)
- : mapnum(mapnum_), teleport_id(teleport_id_) {
+TeleportToEggProcess::TeleportToEggProcess(int mapNum, int teleportId)
+ : _mapNum(mapNum), _teleportId(teleportId) {
_type = 1; // CONSTANT! (type 1 = persistent)
}
@@ -48,7 +48,7 @@ TeleportToEggProcess::TeleportToEggProcess(int mapnum_, int teleport_id_)
void TeleportToEggProcess::run() {
MainActor *av = getMainActor();
- av->teleport(mapnum, teleport_id);
+ av->teleport(_mapNum, _teleportId);
terminate();
}
@@ -56,15 +56,15 @@ void TeleportToEggProcess::run() {
void TeleportToEggProcess::saveData(ODataSource *ods) {
Process::saveData(ods);
- ods->write4(static_cast<uint32>(mapnum));
- ods->write4(static_cast<uint32>(teleport_id));
+ ods->write4(static_cast<uint32>(_mapNum));
+ ods->write4(static_cast<uint32>(_teleportId));
}
bool TeleportToEggProcess::loadData(IDataSource *ids, uint32 version) {
if (!Process::loadData(ids, version)) return false;
- mapnum = static_cast<int>(ids->read4());
- teleport_id = static_cast<int>(ids->read4());
+ _mapNum = static_cast<int>(ids->read4());
+ _teleportId = static_cast<int>(ids->read4());
return true;
}
diff --git a/engines/ultima/ultima8/world/actors/teleport_to_egg_process.h b/engines/ultima/ultima8/world/actors/teleport_to_egg_process.h
index 3d94e6d..f3c712a 100644
--- a/engines/ultima/ultima8/world/actors/teleport_to_egg_process.h
+++ b/engines/ultima/ultima8/world/actors/teleport_to_egg_process.h
@@ -44,8 +44,8 @@ public:
protected:
void saveData(ODataSource *ods) override;
- int mapnum;
- int teleport_id;
+ int _mapNum;
+ int _teleportId;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/actors/treasure_info.h b/engines/ultima/ultima8/world/actors/treasure_info.h
index fda616f..45e95da 100644
--- a/engines/ultima/ultima8/world/actors/treasure_info.h
+++ b/engines/ultima/ultima8/world/actors/treasure_info.h
@@ -30,14 +30,14 @@ namespace Ultima {
namespace Ultima8 {
struct TreasureInfo {
- Std::string special;
- double chance;
- int map;
- Std::vector<uint32> shapes;
- Std::vector<uint32> frames;
- unsigned int mincount, maxcount;
+ Std::string _special;
+ double _chance;
+ int _map;
+ Std::vector<uint32> _shapes;
+ Std::vector<uint32> _frames;
+ unsigned int _minCount, _maxCount;
- TreasureInfo() : chance(1), map(0), mincount(1), maxcount(1) {}
+ TreasureInfo() : _chance(1), _map(0), _minCount(1), _maxCount(1) {}
};
} // End of namespace Ultima8
Commit: b67a6456deaeac3d30324e9c9562e00b441c6960
https://github.com/scummvm/scummvm/commit/b67a6456deaeac3d30324e9c9562e00b441c6960
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-17T19:42:21-08:00
Commit Message:
ULTIMA8: Renaming audio class fields
Changed paths:
engines/ultima/ultima8/audio/audio_mixer.cpp
engines/ultima/ultima8/audio/audio_mixer.h
engines/ultima/ultima8/audio/audio_process.cpp
engines/ultima/ultima8/audio/audio_process.h
engines/ultima/ultima8/audio/audio_sample.cpp
engines/ultima/ultima8/audio/audio_sample.h
engines/ultima/ultima8/audio/music_flex.cpp
engines/ultima/ultima8/audio/music_flex.h
engines/ultima/ultima8/audio/raw_audio_sample.cpp
engines/ultima/ultima8/audio/raw_audio_sample.h
engines/ultima/ultima8/audio/sonarc_audio_sample.cpp
engines/ultima/ultima8/audio/sonarc_audio_sample.h
engines/ultima/ultima8/convert/u8/convert_usecode_u8.h
diff --git a/engines/ultima/ultima8/audio/audio_mixer.cpp b/engines/ultima/ultima8/audio/audio_mixer.cpp
index 382392c..a4722a6 100644
--- a/engines/ultima/ultima8/audio/audio_mixer.cpp
+++ b/engines/ultima/ultima8/audio/audio_mixer.cpp
@@ -33,10 +33,10 @@
namespace Ultima {
namespace Ultima8 {
-AudioMixer *AudioMixer::the_audio_mixer = 0;
+AudioMixer *AudioMixer::_audioMixer = 0;
AudioMixer::AudioMixer(Audio::Mixer *mixer) : _mixer(mixer), _midiPlayer(0) {
- the_audio_mixer = this;
+ _audioMixer = this;
_channels.resize(CHANNEL_COUNT);
for (int idx = 0; idx < CHANNEL_COUNT; ++idx)
diff --git a/engines/ultima/ultima8/audio/audio_mixer.h b/engines/ultima/ultima8/audio/audio_mixer.h
index 3012a30..278a6ba 100644
--- a/engines/ultima/ultima8/audio/audio_mixer.h
+++ b/engines/ultima/ultima8/audio/audio_mixer.h
@@ -39,7 +39,7 @@ class AudioSample;
class AudioMixer {
private:
- static AudioMixer *the_audio_mixer;
+ static AudioMixer *_audioMixer;
Audio::Mixer *_mixer;
MidiPlayer *_midiPlayer;
Common::Array<AudioChannel *> _channels;
@@ -55,7 +55,7 @@ public:
}
static AudioMixer *get_instance() {
- return the_audio_mixer;
+ return _audioMixer;
}
void reset();
diff --git a/engines/ultima/ultima8/audio/audio_process.cpp b/engines/ultima/ultima8/audio/audio_process.cpp
index d9359a9..514beae 100644
--- a/engines/ultima/ultima8/audio/audio_process.cpp
+++ b/engines/ultima/ultima8/audio/audio_process.cpp
@@ -53,8 +53,8 @@ AudioProcess::~AudioProcess(void) {
the_audio_process = 0;
}
-bool AudioProcess::calculateSoundVolume(ObjId objid, int16 &lvol, int16 &rvol) const {
- Item *item = getItem(objid);
+bool AudioProcess::calculateSoundVolume(ObjId _objId, int16 &_lVol, int16 &_rVol) const {
+ Item *item = getItem(_objId);
if (!item) return false;
// Need to get items relative coords from avatar
@@ -92,8 +92,8 @@ bool AudioProcess::calculateSoundVolume(ObjId objid, int16 &lvol, int16 &rvol) c
else lbal = 160 - x;
}
- lvol = (dist * lbal) / 160;
- rvol = (dist * rbal) / 160;
+ _lVol = (dist * lbal) / 160;
+ _rVol = (dist * rbal) / 160;
return true;
}
@@ -105,8 +105,8 @@ void AudioProcess::run() {
Std::list<SampleInfo>::iterator it;
for (it = sample_info.begin(); it != sample_info.end();) {
bool finished = false;
- if (!mixer->isPlaying(it->channel)) {
- if (it->sfxnum == -1)
+ if (!mixer->isPlaying(it->_channel)) {
+ if (it->_sfxNum == -1)
finished = !continueSpeech(*it);
else
finished = true;
@@ -116,12 +116,12 @@ void AudioProcess::run() {
it = sample_info.erase(it);
else {
- if (it->sfxnum != -1 && it->objid) {
- it->lvol = 256;
- it->rvol = 256;
- calculateSoundVolume(it->objid, it->lvol, it->rvol);
+ if (it->_sfxNum != -1 && it->_objId) {
+ it->_lVol = 256;
+ it->_rVol = 256;
+ calculateSoundVolume(it->_objId, it->_lVol, it->_rVol);
}
- mixer->setVolume(it->channel, (it->lvol * it->volume) / 256, (it->rvol * it->volume) / 256);
+ mixer->setVolume(it->_channel, (it->_lVol * it->_volume) / 256, (it->_rVol * it->_volume) / 256);
++it;
}
@@ -129,30 +129,30 @@ void AudioProcess::run() {
}
bool AudioProcess::continueSpeech(SampleInfo &si) {
- assert(si.sfxnum == -1);
+ assert(si._sfxNum == -1);
SpeechFlex *speechflex;
- speechflex = GameData::get_instance()->getSpeechFlex(si.priority);
+ speechflex = GameData::get_instance()->getSpeechFlex(si._priority);
if (!speechflex) return false;
- if (si.curspeech_end >= si.barked.size()) return false;
+ if (si._curSpeechEnd >= si._barked.size()) return false;
- si.curspeech_start = si.curspeech_end;
- int index = speechflex->getIndexForPhrase(si.barked,
- si.curspeech_start,
- si.curspeech_end);
+ si._curSpeechStart = si._curSpeechEnd;
+ int index = speechflex->getIndexForPhrase(si._barked,
+ si._curSpeechStart,
+ si._curSpeechEnd);
if (!index) return false;
AudioSample *sample = speechflex->getSample(index);
if (!sample) return false;
// hack to prevent playSample from deleting 'si'
- si.channel = -1;
- int channel = playSample(sample, 200, 0);
- if (channel == -1)
+ si._channel = -1;
+ int _channel = playSample(sample, 200, 0);
+ if (_channel == -1)
return false;
- si.channel = channel;
+ si._channel = _channel;
return true;
}
@@ -164,16 +164,16 @@ void AudioProcess::saveData(ODataSource *ods) {
Std::list<SampleInfo>::iterator it;
for (it = sample_info.begin(); it != sample_info.end(); ++it) {
- ods->write2(it->sfxnum);
- ods->write2(it->priority);
- ods->write2(it->objid);
- ods->write2(it->loops);
- ods->write4(it->pitch_shift);
- ods->write2(it->volume);
-
- if (it->sfxnum == -1) { // Speech
- ods->write4(static_cast<uint32>(it->barked.size()));
- ods->write(it->barked.c_str(), static_cast<uint32>(it->barked.size()));
+ ods->write2(it->_sfxNum);
+ ods->write2(it->_priority);
+ ods->write2(it->_objId);
+ ods->write2(it->_loops);
+ ods->write4(it->_pitchShift);
+ ods->write2(it->_volume);
+
+ if (it->_sfxNum == -1) { // Speech
+ ods->write4(static_cast<uint32>(it->_barked.size()));
+ ods->write(it->_barked.c_str(), static_cast<uint32>(it->_barked.size()));
}
}
}
@@ -184,21 +184,21 @@ bool AudioProcess::loadData(IDataSource *ids, uint32 version) {
uint32 count = ids->read1();
while (count--) {
- int16 sfxnum = ids->read2();
- int16 priority = ids->read2();
- int16 objid = ids->read2();
- int16 loops = ids->read2();
- uint32 pitch_shift = ids->read4();
- uint16 volume = ids->read2();
-
- if (sfxnum != -1) { // SFX
- int16 lvol = 0;
- int16 rvol = 0;
- if (objid != 0) {
- lvol = 256;
- rvol = 256;
+ int16 _sfxNum = ids->read2();
+ int16 _priority = ids->read2();
+ int16 _objId = ids->read2();
+ int16 _loops = ids->read2();
+ uint32 _pitchShift = ids->read4();
+ uint16 _volume = ids->read2();
+
+ if (_sfxNum != -1) { // SFX
+ int16 _lVol = 0;
+ int16 _rVol = 0;
+ if (_objId != 0) {
+ _lVol = 256;
+ _rVol = 256;
}
- playSFX(sfxnum, priority, objid, loops, false, pitch_shift, volume, lvol, rvol);
+ playSFX(_sfxNum, _priority, _objId, _loops, false, _pitchShift, _volume, _lVol, _rVol);
} else { // Speech
uint32 slen = ids->read4();
@@ -208,36 +208,36 @@ bool AudioProcess::loadData(IDataSource *ids, uint32 version) {
Std::string text = buf;
delete[] buf;
- playSpeech(text, priority, objid, pitch_shift, volume);
+ playSpeech(text, _priority, _objId, _pitchShift, _volume);
}
}
return true;
}
-int AudioProcess::playSample(AudioSample *sample, int priority, int loops, uint32 pitch_shift, int16 lvol, int16 rvol) {
+int AudioProcess::playSample(AudioSample *sample, int _priority, int _loops, uint32 _pitchShift, int16 _lVol, int16 _rVol) {
AudioMixer *mixer = AudioMixer::get_instance();
- int channel = mixer->playSample(sample, loops, priority, false, pitch_shift, lvol, rvol);
+ int _channel = mixer->playSample(sample, _loops, _priority, false, _pitchShift, _lVol, _rVol);
- if (channel == -1) return channel;
+ if (_channel == -1) return _channel;
- // Erase old sample using channel (if any)
+ // Erase old sample using _channel (if any)
Std::list<SampleInfo>::iterator it;
for (it = sample_info.begin(); it != sample_info.end();) {
- if (it->channel == channel) {
+ if (it->_channel == _channel) {
it = sample_info.erase(it);
} else {
++it;
}
}
- return channel;
+ return _channel;
}
-void AudioProcess::playSFX(int sfxnum, int priority, ObjId objid, int loops,
- bool no_duplicates, uint32 pitch_shift, uint16 volume,
- int16 lvol, int16 rvol) {
- //con->Printf("playSFX(%i, %i, 0x%X, %i)\n", sfxnum, priority, objid, loops);
+void AudioProcess::playSFX(int _sfxNum, int _priority, ObjId _objId, int _loops,
+ bool no_duplicates, uint32 _pitchShift, uint16 _volume,
+ int16 _lVol, int16 _rVol) {
+ //con->Printf("playSFX(%i, %i, 0x%X, %i)\n", _sfxNum, _priority, _objId, _loops);
SoundFlex *soundflx = GameData::get_instance()->getSoundFlex();
@@ -246,12 +246,12 @@ void AudioProcess::playSFX(int sfxnum, int priority, ObjId objid, int loops,
if (no_duplicates) {
Std::list<SampleInfo>::iterator it;
for (it = sample_info.begin(); it != sample_info.end();) {
- if (it->sfxnum == sfxnum && it->objid == objid &&
- it->loops == loops) {
+ if (it->_sfxNum == _sfxNum && it->_objId == _objId &&
+ it->_loops == _loops) {
// Exactly the same (and playing) so just return
- //if (it->priority == priority)
- if (mixer->isPlaying(it->channel)) {
+ //if (it->_priority == _priority)
+ if (mixer->isPlaying(it->_channel)) {
pout << "Sound already playing" << Std::endl;
return;
} else {
@@ -264,31 +264,31 @@ void AudioProcess::playSFX(int sfxnum, int priority, ObjId objid, int loops,
}
}
- AudioSample *sample = soundflx->getSample(sfxnum);
+ AudioSample *sample = soundflx->getSample(_sfxNum);
if (!sample) return;
- if (lvol == -1 || rvol == -1) {
- lvol = 256;
- rvol = 256;
- if (objid) calculateSoundVolume(objid, lvol, rvol);
+ if (_lVol == -1 || _rVol == -1) {
+ _lVol = 256;
+ _rVol = 256;
+ if (_objId) calculateSoundVolume(_objId, _lVol, _rVol);
}
- int channel = playSample(sample, priority, loops, pitch_shift, (lvol * volume) / 256, (rvol * volume) / 256);
- if (channel == -1) return;
+ int _channel = playSample(sample, _priority, _loops, _pitchShift, (_lVol * _volume) / 256, (_rVol * _volume) / 256);
+ if (_channel == -1) return;
// Update list
- sample_info.push_back(SampleInfo(sfxnum, priority, objid, loops, channel, pitch_shift, volume, lvol, rvol));
+ sample_info.push_back(SampleInfo(_sfxNum, _priority, _objId, _loops, _channel, _pitchShift, _volume, _lVol, _rVol));
}
-void AudioProcess::stopSFX(int sfxnum, ObjId objid) {
- //con->Printf("stopSFX(%i, 0x%X)\n", sfxnum, objid);
+void AudioProcess::stopSFX(int _sfxNum, ObjId _objId) {
+ //con->Printf("stopSFX(%i, 0x%X)\n", _sfxNum, _objId);
AudioMixer *mixer = AudioMixer::get_instance();
Std::list<SampleInfo>::iterator it;
for (it = sample_info.begin(); it != sample_info.end();) {
- if (it->sfxnum == sfxnum && it->objid == objid) {
- if (mixer->isPlaying(it->channel)) mixer->stopSample(it->channel);
+ if (it->_sfxNum == _sfxNum && it->_objId == _objId) {
+ if (mixer->isPlaying(it->_channel)) mixer->stopSample(it->_channel);
it = sample_info.erase(it);
} else {
++it;
@@ -296,30 +296,30 @@ void AudioProcess::stopSFX(int sfxnum, ObjId objid) {
}
}
-bool AudioProcess::isSFXPlaying(int sfxnum) {
- //con->Printf("isSFXPlaying(%i)\n", sfxnum);
+bool AudioProcess::isSFXPlaying(int _sfxNum) {
+ //con->Printf("isSFXPlaying(%i)\n", _sfxNum);
Std::list<SampleInfo>::iterator it;
for (it = sample_info.begin(); it != sample_info.end(); ++it) {
- if (it->sfxnum == sfxnum)
+ if (it->_sfxNum == _sfxNum)
return true;
}
return false;
}
-void AudioProcess::setVolumeSFX(int sfxnum, uint8 volume) {
- //con->Printf("setVolumeSFX(%i, %i)\n", sfxnum, volume);
+void AudioProcess::setVolumeSFX(int _sfxNum, uint8 _volume) {
+ //con->Printf("setVolumeSFX(%i, %i)\n", _sfxNum, _volume);
AudioMixer *mixer = AudioMixer::get_instance();
Std::list<SampleInfo>::iterator it;
for (it = sample_info.begin(); it != sample_info.end(); ++it) {
- if (it->sfxnum == sfxnum && it->sfxnum != -1) {
- it->volume = volume;
+ if (it->_sfxNum == _sfxNum && it->_sfxNum != -1) {
+ it->_volume = _volume;
- int lvol = 256, rvol = 256;
- if (it->objid) calculateSoundVolume(it->objid, it->lvol, it->rvol);
- mixer->setVolume(it->channel, (lvol * it->volume) / 256, (rvol * it->volume) / 256);
+ int _lVol = 256, _rVol = 256;
+ if (it->_objId) calculateSoundVolume(it->_objId, it->_lVol, it->_rVol);
+ mixer->setVolume(it->_channel, (_lVol * it->_volume) / 256, (_rVol * it->_volume) / 256);
}
}
}
@@ -328,7 +328,7 @@ void AudioProcess::setVolumeSFX(int sfxnum, uint8 volume) {
// Speech
//
-bool AudioProcess::playSpeech(Std::string &barked, int shapenum, ObjId objid, uint32 pitch_shift, uint16 volume) {
+bool AudioProcess::playSpeech(Std::string &_barked, int shapenum, ObjId _objId, uint32 _pitchShift, uint16 _volume) {
SpeechFlex *speechflex = GameData::get_instance()->getSpeechFlex(shapenum);
if (!speechflex) return false;
@@ -338,10 +338,10 @@ bool AudioProcess::playSpeech(Std::string &barked, int shapenum, ObjId objid, ui
Std::list<SampleInfo>::iterator it;
for (it = sample_info.begin(); it != sample_info.end();) {
- if (it->sfxnum == -1 && it->barked == barked &&
- it->priority == shapenum && it->objid == objid) {
+ if (it->_sfxNum == -1 && it->_barked == _barked &&
+ it->_priority == shapenum && it->_objId == _objId) {
- if (mixer->isPlaying(it->channel)) {
+ if (mixer->isPlaying(it->_channel)) {
pout << "Speech already playing" << Std::endl;
return true;
} else {
@@ -355,39 +355,39 @@ bool AudioProcess::playSpeech(Std::string &barked, int shapenum, ObjId objid, ui
uint32 speech_start = 0;
uint32 speech_end;
- int index = speechflex->getIndexForPhrase(barked, speech_start, speech_end);
+ int index = speechflex->getIndexForPhrase(_barked, speech_start, speech_end);
if (!index) return false;
AudioSample *sample = speechflex->getSample(index);
if (!sample) return false;
- int channel = playSample(sample, 200, 0, pitch_shift, volume, volume);
+ int _channel = playSample(sample, 200, 0, _pitchShift, _volume, _volume);
- if (channel == -1) return false;
+ if (_channel == -1) return false;
// Update list
- sample_info.push_back(SampleInfo(barked, shapenum, objid, channel,
- speech_start, speech_end, pitch_shift, volume, 256, 256));
+ sample_info.push_back(SampleInfo(_barked, shapenum, _objId, _channel,
+ speech_start, speech_end, _pitchShift, _volume, 256, 256));
return true;
}
-uint32 AudioProcess::getSpeechLength(Std::string &barked, int shapenum) const {
+uint32 AudioProcess::getSpeechLength(Std::string &_barked, int shapenum) const {
SpeechFlex *speechflex = GameData::get_instance()->getSpeechFlex(shapenum);
if (!speechflex) return 0;
- return speechflex->getSpeechLength(barked);
+ return speechflex->getSpeechLength(_barked);
}
-void AudioProcess::stopSpeech(Std::string &barked, int shapenum, ObjId objid) {
+void AudioProcess::stopSpeech(Std::string &_barked, int shapenum, ObjId _objId) {
AudioMixer *mixer = AudioMixer::get_instance();
Std::list<SampleInfo>::iterator it;
for (it = sample_info.begin(); it != sample_info.end();) {
- if (it->sfxnum == -1 && it->priority == shapenum &&
- it->objid == objid && it->barked == barked) {
- if (mixer->isPlaying(it->channel)) mixer->stopSample(it->channel);
+ if (it->_sfxNum == -1 && it->_priority == shapenum &&
+ it->_objId == _objId && it->_barked == _barked) {
+ if (mixer->isPlaying(it->_channel)) mixer->stopSample(it->_channel);
it = sample_info.erase(it);
} else {
++it;
@@ -395,11 +395,11 @@ void AudioProcess::stopSpeech(Std::string &barked, int shapenum, ObjId objid) {
}
}
-bool AudioProcess::isSpeechPlaying(Std::string &barked, int shapenum) {
+bool AudioProcess::isSpeechPlaying(Std::string &_barked, int shapenum) {
Std::list<SampleInfo>::iterator it;
for (it = sample_info.begin(); it != sample_info.end(); ++it) {
- if (it->sfxnum == -1 && it->priority == shapenum &&
- it->barked == barked) {
+ if (it->_sfxNum == -1 && it->_priority == shapenum &&
+ it->_barked == _barked) {
return true;
}
}
@@ -415,8 +415,8 @@ void AudioProcess::pauseAllSamples() {
Std::list<SampleInfo>::iterator it;
for (it = sample_info.begin(); it != sample_info.end();) {
- if (mixer->isPlaying(it->channel)) {
- mixer->setPaused(it->channel, true);
+ if (mixer->isPlaying(it->_channel)) {
+ mixer->setPaused(it->_channel, true);
++it;
} else {
it = sample_info.erase(it);
@@ -434,8 +434,8 @@ void AudioProcess::unpauseAllSamples() {
Std::list<SampleInfo>::iterator it;
for (it = sample_info.begin(); it != sample_info.end();) {
- if (mixer->isPlaying(it->channel)) {
- mixer->setPaused(it->channel, false);
+ if (mixer->isPlaying(it->_channel)) {
+ mixer->setPaused(it->_channel, false);
++it;
} else {
it = sample_info.erase(it);
@@ -450,8 +450,8 @@ void AudioProcess::stopAllExceptSpeech() {
Std::list<SampleInfo>::iterator it;
for (it = sample_info.begin(); it != sample_info.end();) {
- if (it->barked.empty()) {
- if (mixer->isPlaying(it->channel)) mixer->stopSample(it->channel);
+ if (it->_barked.empty()) {
+ if (mixer->isPlaying(it->_channel)) mixer->stopSample(it->_channel);
it = sample_info.erase(it);
} else {
++it;
@@ -464,82 +464,82 @@ void AudioProcess::stopAllExceptSpeech() {
//
uint32 AudioProcess::I_playSFX(const uint8 *args, unsigned int argsize) {
- ARG_SINT16(sfxnum);
+ ARG_SINT16(_sfxNum);
- int16 priority = 0x60;
+ int16 _priority = 0x60;
if (argsize >= 4) {
ARG_SINT16(priority_);
- priority = priority_;
+ _priority = priority_;
}
- ObjId objid = 0;
+ ObjId _objId = 0;
if (argsize == 6) {
ARG_OBJID(objid_);
- objid = objid_;
+ _objId = objid_;
}
AudioProcess *ap = AudioProcess::get_instance();
- if (ap) ap->playSFX(sfxnum, priority, objid, 0);
+ if (ap) ap->playSFX(_sfxNum, _priority, _objId, 0);
else perr << "Error: No AudioProcess" << Std::endl;
return 0;
}
uint32 AudioProcess::I_playAmbientSFX(const uint8 *args, unsigned int argsize) {
- ARG_SINT16(sfxnum);
+ ARG_SINT16(_sfxNum);
- int16 priority = 0x60;
+ int16 _priority = 0x60;
if (argsize >= 4) {
ARG_SINT16(priority_);
- priority = priority_;
+ _priority = priority_;
}
- ObjId objid = 0;
+ ObjId _objId = 0;
if (argsize == 6) {
ARG_OBJID(objid_);
- objid = objid_;
+ _objId = objid_;
}
-// con->Printf("playAmbientSFX(%i, %i, 0x%X)\n", sfxnum, priority, objID);
+// con->Printf("playAmbientSFX(%i, %i, 0x%X)\n", _sfxNum, _priority, objID);
AudioProcess *ap = AudioProcess::get_instance();
- if (ap) ap->playSFX(sfxnum, priority, objid, -1, true);
+ if (ap) ap->playSFX(_sfxNum, _priority, _objId, -1, true);
else perr << "Error: No AudioProcess" << Std::endl;
return 0;
}
uint32 AudioProcess::I_isSFXPlaying(const uint8 *args, unsigned int argsize) {
- ARG_SINT16(sfxnum);
+ ARG_SINT16(_sfxNum);
AudioProcess *ap = AudioProcess::get_instance();
- if (ap) return ap->isSFXPlaying(sfxnum);
+ if (ap) return ap->isSFXPlaying(_sfxNum);
else perr << "Error: No AudioProcess" << Std::endl;
return 0;
}
uint32 AudioProcess::I_setVolumeSFX(const uint8 *args, unsigned int /*argsize*/) {
- // Sets volume for last played instances of sfxnum (???)
- ARG_SINT16(sfxnum);
- ARG_UINT8(volume);
+ // Sets _volume for last played instances of _sfxNum (???)
+ ARG_SINT16(_sfxNum);
+ ARG_UINT8(_volume);
AudioProcess *ap = AudioProcess::get_instance();
- if (ap) ap->setVolumeSFX(sfxnum, volume);
+ if (ap) ap->setVolumeSFX(_sfxNum, _volume);
else perr << "Error: No AudioProcess" << Std::endl;
return 0;
}
uint32 AudioProcess::I_stopSFX(const uint8 *args, unsigned int argsize) {
- ARG_SINT16(sfxnum);
+ ARG_SINT16(_sfxNum);
- ObjId objid = 0;
+ ObjId _objId = 0;
if (argsize == 4) {
ARG_OBJID(objid_);
- objid = objid_;
+ _objId = objid_;
}
AudioProcess *ap = AudioProcess::get_instance();
- if (ap) ap->stopSFX(sfxnum, objid);
+ if (ap) ap->stopSFX(_sfxNum, _objId);
else perr << "Error: No AudioProcess" << Std::endl;
return 0;
@@ -556,9 +556,9 @@ void AudioProcess::ConCmd_listSFX(const Console::ArgvType &argv) {
Std::list<SampleInfo>::iterator it;
for (it = ap->sample_info.begin(); it != ap->sample_info.end(); ++it) {
pout.Print("Sample: num %d, obj %d, loop %d, prio %d",
- it->sfxnum, it->objid, it->loops, it->priority);
- if (!it->barked.empty()) {
- pout << ", speech: \"" << it->barked.substr(it->curspeech_start, it->curspeech_end - it->curspeech_start) << "\"";
+ it->_sfxNum, it->_objId, it->_loops, it->_priority);
+ if (!it->_barked.empty()) {
+ pout << ", speech: \"" << it->_barked.substr(it->_curSpeechStart, it->_curSpeechEnd - it->_curSpeechStart) << "\"";
}
pout << Std::endl;
}
@@ -573,14 +573,14 @@ void AudioProcess::ConCmd_stopSFX(const Console::ArgvType &argv) {
}
if (argv.size() < 2) {
- pout << "usage: stopSFX <sfxnum> [<objid>]" << Std::endl;
+ pout << "usage: stopSFX <_sfxNum> [<_objId>]" << Std::endl;
return;
}
- int sfxnum = static_cast<int>(strtol(argv[1].c_str(), 0, 0));
- ObjId objid = (argv.size() >= 3) ? static_cast<ObjId>(strtol(argv[2].c_str(), 0, 0)) : 0;
+ int _sfxNum = static_cast<int>(strtol(argv[1].c_str(), 0, 0));
+ ObjId _objId = (argv.size() >= 3) ? static_cast<ObjId>(strtol(argv[2].c_str(), 0, 0)) : 0;
- ap->stopSFX(sfxnum, objid);
+ ap->stopSFX(_sfxNum, _objId);
}
// static
@@ -592,13 +592,13 @@ void AudioProcess::ConCmd_playSFX(const Console::ArgvType &argv) {
}
if (argv.size() < 2) {
- pout << "usage: playSFX <sfxnum>" << Std::endl;
+ pout << "usage: playSFX <_sfxNum>" << Std::endl;
return;
}
- int sfxnum = static_cast<int>(strtol(argv[1].c_str(), 0, 0));
+ int _sfxNum = static_cast<int>(strtol(argv[1].c_str(), 0, 0));
- ap->playSFX(sfxnum, 0x60, 0, 0);
+ ap->playSFX(_sfxNum, 0x60, 0, 0);
}
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/audio/audio_process.h b/engines/ultima/ultima8/audio/audio_process.h
index b0d512d..6aa2c64 100644
--- a/engines/ultima/ultima8/audio/audio_process.h
+++ b/engines/ultima/ultima8/audio/audio_process.h
@@ -37,27 +37,27 @@ class AudioSample;
class AudioProcess :
public Process {
struct SampleInfo {
- int32 sfxnum;
- int32 priority;
- ObjId objid;
- int32 loops;
- int32 channel;
- Std::string barked;
- uint32 curspeech_start, curspeech_end;
- uint32 pitch_shift; // 0x10000 is normal
- uint16 volume; // 0-256
- int16 lvol;
- int16 rvol;
-
- SampleInfo() : sfxnum(-1) { }
+ int32 _sfxNum;
+ int32 _priority;
+ ObjId _objId;
+ int32 _loops;
+ int32 _channel;
+ Std::string _barked;
+ uint32 _curSpeechStart, _curSpeechEnd;
+ uint32 _pitchShift; // 0x10000 is normal
+ uint16 _volume; // 0-256
+ int16 _lVol;
+ int16 _rVol;
+
+ SampleInfo() : _sfxNum(-1) { }
SampleInfo(int32 s, int32 p, ObjId o, int32 l, int32 c, uint32 ps, uint16 v, int16 lv, int16 rv) :
- sfxnum(s), priority(p), objid(o), loops(l), channel(c),
- pitch_shift(ps), volume(v), lvol(lv), rvol(rv) { }
+ _sfxNum(s), _priority(p), _objId(o), _loops(l), _channel(c),
+ _pitchShift(ps), _volume(v), _lVol(lv), _rVol(rv) { }
SampleInfo(Std::string &b, int32 shpnum, ObjId o, int32 c,
uint32 s, uint32 e, uint32 ps, uint16 v, int16 lv, int16 rv) :
- sfxnum(-1), priority(shpnum), objid(o), loops(0), channel(c), barked(b),
- curspeech_start(s), curspeech_end(e), pitch_shift(ps), volume(v),
- lvol(lv), rvol(rv) { }
+ _sfxNum(-1), _priority(shpnum), _objId(o), _loops(0), _channel(c), _barked(b),
+ _curSpeechStart(s), _curSpeechEnd(e), _pitchShift(ps), _volume(v),
+ _lVol(lv), _rVol(rv) { }
};
Std::list<SampleInfo> sample_info;
@@ -87,32 +87,32 @@ public:
void run() override;
- void playSFX(int sfxnum, int priority, ObjId objid, int loops,
- bool no_duplicates, uint32 pitch_shift,
- uint16 volume, int16 lvol, int16 rvol);
+ void playSFX(int _sfxNum, int _priority, ObjId _objId, int _loops,
+ bool no_duplicates, uint32 _pitchShift,
+ uint16 _volume, int16 _lVol, int16 _rVol);
- void playSFX(int sfxnum, int priority, ObjId objid, int loops,
- bool no_duplicates = false, uint32 pitch_shift = 0x10000,
- uint16 volume = 0x80) {
- playSFX(sfxnum, priority, objid, loops, no_duplicates, pitch_shift, volume, -1, -1);
+ void playSFX(int _sfxNum, int _priority, ObjId _objId, int _loops,
+ bool no_duplicates = false, uint32 _pitchShift = 0x10000,
+ uint16 _volume = 0x80) {
+ playSFX(_sfxNum, _priority, _objId, _loops, no_duplicates, _pitchShift, _volume, -1, -1);
}
- void stopSFX(int sfxnum, ObjId objid);
- bool isSFXPlaying(int sfxnum);
- void setVolumeSFX(int sfxnum, uint8 volume);
+ void stopSFX(int _sfxNum, ObjId _objId);
+ bool isSFXPlaying(int _sfxNum);
+ void setVolumeSFX(int _sfxNum, uint8 _volume);
- bool playSpeech(Std::string &barked, int shapenum, ObjId objid,
- uint32 pitch_shift = 0x10000, uint16 volume = 256);
- void stopSpeech(Std::string &barked, int shapenum, ObjId objid);
- bool isSpeechPlaying(Std::string &barked, int shapenum);
+ bool playSpeech(Std::string &_barked, int shapenum, ObjId _objId,
+ uint32 _pitchShift = 0x10000, uint16 _volume = 256);
+ void stopSpeech(Std::string &_barked, int shapenum, ObjId _objId);
+ bool isSpeechPlaying(Std::string &_barked, int shapenum);
//! get length (in milliseconds) of speech
- uint32 getSpeechLength(Std::string &barked, int shapenum) const;
+ uint32 getSpeechLength(Std::string &_barked, int shapenum) const;
//! play a sample (without storing a SampleInfo)
- //! returns channel sample is played on, or -1
- int playSample(AudioSample *sample, int priority, int loops,
- uint32 pitch_shift = 0x10000, int16 lvol = 256, int16 rvol = 256);
+ //! returns _channel sample is played on, or -1
+ int playSample(AudioSample *sample, int _priority, int _loops,
+ uint32 _pitchShift = 0x10000, int16 _lVol = 256, int16 _rVol = 256);
//! pause all currently playing samples
void pauseAllSamples();
@@ -136,7 +136,7 @@ private:
//! returns true if there was speech left to play, or false if finished
bool continueSpeech(SampleInfo &si);
- bool calculateSoundVolume(ObjId objid, int16 &lvol, int16 &rvol) const;
+ bool calculateSoundVolume(ObjId _objId, int16 &_lVol, int16 &_rVol) const;
static AudioProcess *the_audio_process;
};
diff --git a/engines/ultima/ultima8/audio/audio_sample.cpp b/engines/ultima/ultima8/audio/audio_sample.cpp
index 7d9dba8..1575091 100644
--- a/engines/ultima/ultima8/audio/audio_sample.cpp
+++ b/engines/ultima/ultima8/audio/audio_sample.cpp
@@ -26,14 +26,14 @@
namespace Ultima {
namespace Ultima8 {
-AudioSample::AudioSample(uint8 *buffer_, uint32 size_) :
- sample_rate(0), bits(0), stereo(false),
- frame_size(0), decompressor_size(0), length(0),
- buffer_size(size_), buffer(buffer_) {
+AudioSample::AudioSample(uint8 *buffer, uint32 size) :
+ _sampleRate(0), _bits(0), _stereo(false),
+ _frameSize(0), _decompressorSize(0), _length(0),
+ _bufferSize(size), _buffer(buffer) {
}
AudioSample::~AudioSample(void) {
- delete [] buffer;
+ delete [] _buffer;
}
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/audio/audio_sample.h b/engines/ultima/ultima8/audio/audio_sample.h
index c8d32de..54fa91c 100644
--- a/engines/ultima/ultima8/audio/audio_sample.h
+++ b/engines/ultima/ultima8/audio/audio_sample.h
@@ -30,39 +30,39 @@ class IDataSource;
class AudioSample {
protected:
- uint32 sample_rate;
- uint32 bits;
- bool stereo;
- int frame_size;
- uint32 decompressor_size;
- uint32 length;
+ uint32 _sampleRate;
+ uint32 _bits;
+ bool _stereo;
+ int _frameSize;
+ uint32 _decompressorSize;
+ uint32 _length;
- uint32 buffer_size;
- uint8 *buffer;
+ uint32 _bufferSize;
+ uint8 *_buffer;
public:
AudioSample(uint8 *buffer, uint32 size);
virtual ~AudioSample(void);
inline uint32 getRate() const {
- return sample_rate;
+ return _sampleRate;
}
inline uint32 getBits() const {
- return bits;
+ return _bits;
}
inline bool isStereo() const {
- return stereo;
+ return _stereo;
}
inline uint32 getFrameSize() const {
- return frame_size;
+ return _frameSize;
}
inline uint32 getDecompressorDataSize() const {
- return decompressor_size;
+ return _decompressorSize;
}
- //! get AudioSample length (in samples)
+ //! get AudioSample _length (in samples)
inline uint32 getLength() const {
- return length;
+ return _length;
}
virtual void initDecompressor(void *DecompData) const = 0;
diff --git a/engines/ultima/ultima8/audio/music_flex.cpp b/engines/ultima/ultima8/audio/music_flex.cpp
index c206739..9acddee 100644
--- a/engines/ultima/ultima8/audio/music_flex.cpp
+++ b/engines/ultima/ultima8/audio/music_flex.cpp
@@ -32,31 +32,31 @@ DEFINE_RUNTIME_CLASSTYPE_CODE(MusicFlex, Archive)
MusicFlex::MusicFlex(IDataSource *ds) : Archive(ds) {
- songs = 0;
- Std::memset(info, 0, sizeof(SongInfo *) * 128);
+ _songs = 0;
+ Std::memset(_info, 0, sizeof(SongInfo *) * 128);
loadSongInfo();
}
MusicFlex::~MusicFlex() {
uint32 i;
for (i = 0; i < 128; i++) {
- delete info[i];
- info[i] = 0;
+ delete _info[i];
+ _info[i] = 0;
}
Archive::uncache();
- delete [] songs;
+ delete [] _songs;
}
-MusicFlex::SongInfo::SongInfo() : num_measures(0), loop_jump(0) {
- Std::memset(filename, 0, 16);
- Std::memset(transitions, 0, 128 * sizeof(int *));
+MusicFlex::SongInfo::SongInfo() : _numMeasures(0), _loopJump(0) {
+ Std::memset(_filename, 0, 16);
+ Std::memset(_transitions, 0, 128 * sizeof(int *));
}
MusicFlex::SongInfo::~SongInfo() {
for (int i = 0; i < 128; i++) {
- delete [] transitions[i];
- transitions[i] = 0;
+ delete [] _transitions[i];
+ _transitions[i] = 0;
}
}
@@ -70,9 +70,9 @@ void MusicFlex::uncache(uint32 index) {
bool MusicFlex::isCached(uint32 index) {
if (index >= _count) return false;
- if (!songs) return false;
+ if (!_songs) return false;
- return (songs[index] != 0);
+ return (_songs[index] != 0);
}
IDataSource *MusicFlex::getAdlibTimbres() {
@@ -86,7 +86,7 @@ void MusicFlex::loadSongInfo() {
uint8 *buf = getRawObject(0, &size);
if (!buf || !size) {
- error("Unable to load song info from sound/music.flx");
+ error("Unable to load song _info from sound/music.flx");
}
IBufferDataSource ds(buf, size);
Std::string line;
@@ -115,23 +115,23 @@ void MusicFlex::loadSongInfo() {
endIdx = line.findFirstOf(' ', begIdx);
int measures = Std::atoi(line.substr(begIdx, endIdx - begIdx).c_str());
- // Now finally loop_jump
+ // Now finally _loopJump
begIdx = line.findFirstNotOf(' ', endIdx);
endIdx = line.findFirstOf(' ', begIdx);
- int loop_jump = Std::atoi(line.substr(begIdx, endIdx - begIdx).c_str());
+ int _loopJump = Std::atoi(line.substr(begIdx, endIdx - begIdx).c_str());
// Uh oh
if (num < 0 || num > 127)
- error("Invalid Section 1 song info data. num out of range");
+ error("Invalid Section 1 song _info data. num out of range");
- if (info[num])
- error("Invalid Section 1 song info data. num already defined");
+ if (_info[num])
+ error("Invalid Section 1 song _info data. num already defined");
- info[num] = new SongInfo();
+ _info[num] = new SongInfo();
- Std::strncpy(info[num]->filename, name.c_str(), 16);
- info[num]->num_measures = measures;
- info[num]->loop_jump = loop_jump;
+ Std::strncpy(_info[num]->_filename, name.c_str(), 16);
+ _info[num]->_numMeasures = measures;
+ _info[num]->_loopJump = _loopJump;
};
// Read 'Section2', or more like skip it, since it's only trans.xmi
@@ -151,7 +151,7 @@ void MusicFlex::loadSongInfo() {
if (line.at(0) == '#') break;
}
- // Read 'Section4' (trans info)
+ // Read 'Section4' (trans _info)
for (;;) {
ds.readline(line);
@@ -173,32 +173,32 @@ void MusicFlex::loadSongInfo() {
// Find index of from name
int fi;
for (fi = 0; fi < 128; fi++) {
- if (info[fi] && from == info[fi]->filename) break;
+ if (_info[fi] && from == _info[fi]->_filename) break;
}
if (fi == 128)
- error("Invalid Section 4 song info data. Unable to find 'from' index (%s)", from.c_str());
+ error("Invalid Section 4 song _info data. Unable to find 'from' index (%s)", from.c_str());
// Find index of to name
int ti;
for (ti = 0; ti < 128; ti++) {
- if (info[ti] && to == info[ti]->filename) break;
+ if (_info[ti] && to == _info[ti]->_filename) break;
}
if (ti == 128)
- error("Invalid Section 4 song info data. Unable to find 'to' index (%s)", to.c_str());
+ error("Invalid Section 4 song _info data. Unable to find 'to' index (%s)", to.c_str());
- // Allocate Transition info
- info[fi]->transitions[ti] = new int[info[fi]->num_measures];
+ // Allocate Transition _info
+ _info[fi]->_transitions[ti] = new int[_info[fi]->_numMeasures];
- // Now attempt to read the trans info for the
- for (int m = 0; m < info[fi]->num_measures; m++) {
- // Get trans info name
+ // Now attempt to read the trans _info for the
+ for (int m = 0; m < _info[fi]->_numMeasures; m++) {
+ // Get trans _info name
begIdx = line.findFirstNotOf(' ', endIdx);
endIdx = line.findFirstOf(' ', begIdx);
if (begIdx == Std::string::npos)
- error("Invalid Section 4 song info data. Unable to read transitions for all measures");
+ error("Invalid Section 4 song _info data. Unable to read _transitions for all measures");
Std::string trans = line.substr(begIdx, endIdx - begIdx);
const char *str = trans.c_str();
@@ -211,7 +211,7 @@ void MusicFlex::loadSongInfo() {
else
num = atoi(str + 1);
- info[fi]->transitions[ti][m] = num;
+ _info[fi]->_transitions[ti][m] = num;
}
}
diff --git a/engines/ultima/ultima8/audio/music_flex.h b/engines/ultima/ultima8/audio/music_flex.h
index 92161ef..9ef58ce 100644
--- a/engines/ultima/ultima8/audio/music_flex.h
+++ b/engines/ultima/ultima8/audio/music_flex.h
@@ -39,10 +39,10 @@ public:
SongInfo();
~SongInfo();
- char filename[16];
- int num_measures;
- int loop_jump;
- int *transitions[128];
+ char _filename[16];
+ int _numMeasures;
+ int _loopJump;
+ int *_transitions[128];
};
MusicFlex(IDataSource *ds);
@@ -52,13 +52,13 @@ public:
XMidiFile *getXMidi(uint32 index) {
if (index >= _count) return 0;
cache(index);
- return songs[index];
+ return _songs[index];
}
//! Get song info
const SongInfo *getSongInfo(uint32 index) const {
if (index > 127) return 0;
- return info[index];
+ return _info[index];
}
//! Get the Adlib Timbres (index 259)
@@ -73,8 +73,8 @@ public:
}
private:
- SongInfo *info[128];
- XMidiFile **songs;
+ SongInfo *_info[128];
+ XMidiFile **_songs;
//! Load the song info
void loadSongInfo();
diff --git a/engines/ultima/ultima8/audio/raw_audio_sample.cpp b/engines/ultima/ultima8/audio/raw_audio_sample.cpp
index dd5d822..c21f518 100644
--- a/engines/ultima/ultima8/audio/raw_audio_sample.cpp
+++ b/engines/ultima/ultima8/audio/raw_audio_sample.cpp
@@ -27,15 +27,15 @@
namespace Ultima {
namespace Ultima8 {
-RawAudioSample::RawAudioSample(uint8 *buffer_, uint32 size_, uint32 rate_,
- bool signeddata_, bool stereo_)
- : AudioSample(buffer_, size_), signeddata(signeddata_) {
- sample_rate = rate_;
- bits = 8;
- stereo = stereo_;
- frame_size = 512;
- decompressor_size = sizeof(RawDecompData);
- length = size_;
+RawAudioSample::RawAudioSample(uint8 *buffer_, uint32 size, uint32 rate,
+ bool signedData, bool stereo)
+ : AudioSample(buffer_, size), _signedData(signedData) {
+ _sampleRate = rate;
+ _bits = 8;
+ _stereo = stereo;
+ _frameSize = 512;
+ _decompressorSize = sizeof(RawDecompData);
+ _length = size;
}
RawAudioSample::~RawAudioSample() {
@@ -44,7 +44,7 @@ RawAudioSample::~RawAudioSample() {
void RawAudioSample::initDecompressor(void *DecompData) const {
RawDecompData *decomp = reinterpret_cast<RawDecompData *>(DecompData);
- decomp->pos = 0;
+ decomp->_pos = 0;
}
void RawAudioSample::rewind(void *DecompData) const {
@@ -54,21 +54,21 @@ void RawAudioSample::rewind(void *DecompData) const {
uint32 RawAudioSample::decompressFrame(void *DecompData, void *samples) const {
RawDecompData *decomp = reinterpret_cast<RawDecompData *>(DecompData);
- if (decomp->pos == buffer_size) return 0;
+ if (decomp->_pos == _bufferSize) return 0;
- uint32 count = frame_size;
- if (decomp->pos + count > buffer_size)
- count = buffer_size - decomp->pos;
+ uint32 count = _frameSize;
+ if (decomp->_pos + count > _bufferSize)
+ count = _bufferSize - decomp->_pos;
- if (!signeddata) {
- Std::memcpy(samples, buffer + decomp->pos, count);
+ if (!_signedData) {
+ Std::memcpy(samples, _buffer + decomp->_pos, count);
} else {
uint8 *dest = static_cast<uint8 *>(samples);
for (unsigned int i = 0; i < count; ++i)
- dest[i] = buffer[decomp->pos + i] + 128;
+ dest[i] = _buffer[decomp->_pos + i] + 128;
}
- decomp->pos += count;
+ decomp->_pos += count;
return count;
}
diff --git a/engines/ultima/ultima8/audio/raw_audio_sample.h b/engines/ultima/ultima8/audio/raw_audio_sample.h
index 5d8c8a9..617973e 100644
--- a/engines/ultima/ultima8/audio/raw_audio_sample.h
+++ b/engines/ultima/ultima8/audio/raw_audio_sample.h
@@ -41,11 +41,10 @@ public:
protected:
struct RawDecompData {
- uint32 pos;
+ uint32 _pos;
};
- bool signeddata;
-
+ bool _signedData;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/audio/sonarc_audio_sample.cpp b/engines/ultima/ultima8/audio/sonarc_audio_sample.cpp
index bf13c3d..ef1f5a5 100644
--- a/engines/ultima/ultima8/audio/sonarc_audio_sample.cpp
+++ b/engines/ultima/ultima8/audio/sonarc_audio_sample.cpp
@@ -27,40 +27,37 @@
namespace Ultima {
namespace Ultima8 {
-bool SonarcAudioSample::GeneratedOneTable = false;
-int SonarcAudioSample::OneTable[256];
+bool SonarcAudioSample::_generatedOneTable = false;
+int SonarcAudioSample::_oneTable[256];
-SonarcAudioSample::SonarcAudioSample(uint8 *buffer_, uint32 size_) :
- AudioSample(buffer_, size_),
- src_offset(0x20)
+SonarcAudioSample::SonarcAudioSample(uint8 *buffer, uint32 size) :
+ AudioSample(buffer, size), _srcOffset(0x20) {
+ if (!_generatedOneTable) GenerateOneTable();
-{
- if (!GeneratedOneTable) GenerateOneTable();
+ _length = *_buffer;
+ _length |= *(_buffer + 1) << 8;
+ _length |= *(_buffer + 2) << 16;
+ _length |= *(_buffer + 3) << 24;
- length = *buffer;
- length |= *(buffer + 1) << 8;
- length |= *(buffer + 2) << 16;
- length |= *(buffer + 3) << 24;
-
- sample_rate = *(buffer + 4);
- sample_rate |= *(buffer + 5) << 8;
- bits = 8;
- stereo = false;
+ _sampleRate = *(_buffer + 4);
+ _sampleRate |= *(_buffer + 5) << 8;
+ _bits = 8;
+ _stereo = false;
// Get frame bytes... we need to compensate for 'large' files
- uint32 frame_bytes = *(buffer + src_offset);
- frame_bytes |= (*(buffer + src_offset + 1)) << 8;
+ uint32 frame_bytes = *(_buffer + _srcOffset);
+ frame_bytes |= (*(_buffer + _srcOffset + 1)) << 8;
- if (frame_bytes == 0x20 && length > 32767) {
- src_offset += 0x100;
+ if (frame_bytes == 0x20 && _length > 32767) {
+ _srcOffset += 0x100;
}
// Get Num Frame Samples
- frame_size = *(buffer + src_offset + 2);
- frame_size |= (*(buffer + src_offset + 3)) << 8;
+ _frameSize = *(_buffer + _srcOffset + 2);
+ _frameSize |= (*(_buffer + _srcOffset + 3)) << 8;
- decompressor_size = sizeof(SonarcDecompData);
+ _decompressorSize = sizeof(SonarcDecompData);
}
SonarcAudioSample::~SonarcAudioSample(void) {
@@ -71,17 +68,17 @@ SonarcAudioSample::~SonarcAudioSample(void) {
//
void SonarcAudioSample::GenerateOneTable() {
- // OneTable[x] gives the number of consecutive 1's on the low side of x
+ // _oneTable[x] gives the number of consecutive 1's on the low side of x
for (int i = 0; i < 256; ++i)
- OneTable[i] = 0;
+ _oneTable[i] = 0;
for (int power = 2; power < 32; power *= 2)
for (int col = power - 1; col < 16; col += power)
for (int row = 0; row < 16; ++row)
- OneTable[row * 16 + col]++;
+ _oneTable[row * 16 + col]++;
for (int i = 0; i < 16; ++i)
- OneTable[i * 16 + 15] += OneTable[i];
+ _oneTable[i * 16 + 15] += _oneTable[i];
}
void SonarcAudioSample::decode_EC(int mode, int samplecount,
@@ -115,11 +112,11 @@ void SonarcAudioSample::decode_EC(int mode, int samplecount,
}
uint8 lowByte = data & 0xFF;
- int ones = OneTable[lowByte];
+ int ones = _oneTable[lowByte];
if (ones == 0) {
data >>= 1; // strip zero
- // low byte contains (mode+1) bits of the sample
+ // low byte contains (mode+1) _bits of the sample
int8 sample = data & 0xFF;
sample <<= (7 - mode);
sample >>= (7 - mode); // sign extend
@@ -128,7 +125,7 @@ void SonarcAudioSample::decode_EC(int mode, int samplecount,
inputbits -= mode + 2;
} else if (ones < 7 - mode) {
data >>= ones + 1; // strip ones and zero
- // low byte contains (mode+ones) bits of the sample
+ // low byte contains (mode+ones) _bits of the sample
int8 sample = data & 0xFF;
sample <<= (7 - mode - ones);
sample &= 0x7F;
@@ -140,7 +137,7 @@ void SonarcAudioSample::decode_EC(int mode, int samplecount,
inputbits -= mode + 2 * ones + 1;
} else {
data >>= (7 - mode); // strip ones
- // low byte contains 7 bits of the sample
+ // low byte contains 7 _bits of the sample
int8 sample = data & 0xFF;
sample &= 0x7F;
if (!(sample & 0x40))
@@ -211,36 +208,36 @@ int SonarcAudioSample::audio_decode(const uint8 *source, uint8 *dest) {
void SonarcAudioSample::initDecompressor(void *DecompData) const {
SonarcDecompData *decomp = reinterpret_cast<SonarcDecompData *>(DecompData);
- decomp->pos = src_offset;
- decomp->sample_pos = 0;
+ decomp->_pos = _srcOffset;
+ decomp->_samplePos = 0;
}
uint32 SonarcAudioSample::decompressFrame(void *DecompData, void *samples) const {
SonarcDecompData *decomp = reinterpret_cast<SonarcDecompData *>(DecompData);
- if (decomp->pos == buffer_size) return 0;
- if (decomp->sample_pos == length) return 0;
+ if (decomp->_pos == _bufferSize) return 0;
+ if (decomp->_samplePos == _length) return 0;
// Get Frame size
- uint32 frame_bytes = *(buffer + decomp->pos);
- frame_bytes |= (*(buffer + decomp->pos + 1)) << 8;
+ uint32 frame_bytes = *(_buffer + decomp->_pos);
+ frame_bytes |= (*(_buffer + decomp->_pos + 1)) << 8;
// Get Num Frame Samples
- uint32 frame_samples = *(buffer + decomp->pos + 2);
- frame_samples |= (*(buffer + decomp->pos + 3)) << 8;
+ uint32 frame_samples = *(_buffer + decomp->_pos + 2);
+ frame_samples |= (*(_buffer + decomp->_pos + 3)) << 8;
- audio_decode(buffer + decomp->pos, reinterpret_cast<uint8 *>(samples));
+ audio_decode(_buffer + decomp->_pos, reinterpret_cast<uint8 *>(samples));
- decomp->pos += frame_bytes;
- decomp->sample_pos += frame_samples;
+ decomp->_pos += frame_bytes;
+ decomp->_samplePos += frame_samples;
return frame_samples;
}
void SonarcAudioSample::rewind(void *DecompData) const {
SonarcDecompData *decomp = reinterpret_cast<SonarcDecompData *>(DecompData);
- decomp->pos = src_offset;
- decomp->sample_pos = 0;
+ decomp->_pos = _srcOffset;
+ decomp->_samplePos = 0;
}
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/audio/sonarc_audio_sample.h b/engines/ultima/ultima8/audio/sonarc_audio_sample.h
index fba50ed..a067f2d 100644
--- a/engines/ultima/ultima8/audio/sonarc_audio_sample.h
+++ b/engines/ultima/ultima8/audio/sonarc_audio_sample.h
@@ -30,12 +30,12 @@ namespace Ultima8 {
class SonarcAudioSample : public AudioSample {
struct SonarcDecompData {
- uint32 pos;
- uint32 sample_pos;
+ uint32 _pos;
+ uint32 _samplePos;
};
- static bool GeneratedOneTable;
- static int OneTable[256];
+ static bool _generatedOneTable;
+ static int _oneTable[256];
static void GenerateOneTable();
@@ -46,10 +46,10 @@ class SonarcAudioSample : public AudioSample {
uint8 *dest, const uint8 *factors);
static int audio_decode(const uint8 *source, uint8 *dest);
- uint32 src_offset;
+ uint32 _srcOffset;
public:
- SonarcAudioSample(uint8 *buffer_, uint32 size_);
+ SonarcAudioSample(uint8 *buffer, uint32 size);
~SonarcAudioSample(void) override;
void initDecompressor(void *DecompData) const override;
diff --git a/engines/ultima/ultima8/convert/u8/convert_usecode_u8.h b/engines/ultima/ultima8/convert/u8/convert_usecode_u8.h
index 136f047..9d5a4bd 100644
--- a/engines/ultima/ultima8/convert/u8/convert_usecode_u8.h
+++ b/engines/ultima/ultima8/convert/u8/convert_usecode_u8.h
@@ -38,7 +38,7 @@ public:
typedef int DebugSymbol;
struct UsecodeHeader
{
- uint32 maxOffset;
+ uint32 _maxOffset;
};
uint32 read4(IDataSource *) { return 0; }
uint32 curOffset;
@@ -419,7 +419,7 @@ void ConvertUsecodeU8::readheader(IDataSource *ucfile, UsecodeHeader &uch, uint3
curOffset_ = 0;
#else
read4(ucfile); // unknown
- uch.maxOffset = read4(ucfile) - 0x0C; // file size
+ uch._maxOffset = read4(ucfile) - 0x0C; // file size
read4(ucfile); // unknown
curOffset_ = 0;
#endif
Commit: a18ebbb63523a34cc179caed8f8a719bfc38c18f
https://github.com/scummvm/scummvm/commit/a18ebbb63523a34cc179caed8f8a719bfc38c18f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-17T19:42:21-08:00
Commit Message:
ULTIMA8: Renaming font classes fields
Changed paths:
engines/ultima/ultima8/graphics/fonts/fixed_width_font.cpp
engines/ultima/ultima8/graphics/fonts/fixed_width_font.h
engines/ultima/ultima8/graphics/fonts/font.cpp
engines/ultima/ultima8/graphics/fonts/font.h
engines/ultima/ultima8/graphics/fonts/font_manager.cpp
engines/ultima/ultima8/graphics/fonts/font_manager.h
engines/ultima/ultima8/graphics/fonts/jp_rendered_text.cpp
engines/ultima/ultima8/graphics/fonts/shape_rendered_text.cpp
engines/ultima/ultima8/graphics/fonts/tt_font.cpp
engines/ultima/ultima8/graphics/soft_render_surface.cpp
engines/ultima/ultima8/misc/console.cpp
engines/ultima/ultima8/ultima8.cpp
diff --git a/engines/ultima/ultima8/graphics/fonts/fixed_width_font.cpp b/engines/ultima/ultima8/graphics/fonts/fixed_width_font.cpp
index 6c09db6..252cfbf 100644
--- a/engines/ultima/ultima8/graphics/fonts/fixed_width_font.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/fixed_width_font.cpp
@@ -22,7 +22,6 @@
#include "ultima/ultima8/misc/pent_include.h"
#include "ultima/ultima8/graphics/fonts/fixed_width_font.h"
-
#include "ultima/ultima8/graphics/texture.h"
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/conf/config_file_manager.h"
@@ -59,29 +58,29 @@ FixedWidthFont *FixedWidthFont::Create(Std::string iniroot) {
FixedWidthFont *fwf = new FixedWidthFont;
- fwf->tex = fonttex;
+ fwf->_tex = fonttex;
- if (!config->get(iniroot + "/font/width", fwf->width)) {
- fwf->width = fwf->tex->_width / 16;
+ if (!config->get(iniroot + "/font/width", fwf->_width)) {
+ fwf->_width = fwf->_tex->_width / 16;
}
- if (!config->get(iniroot + "/font/height", fwf->height)) {
- fwf->height = fwf->tex->_height / 16;
+ if (!config->get(iniroot + "/font/height", fwf->_height)) {
+ fwf->_height = fwf->_tex->_height / 16;
}
- if (!config->get(iniroot + "/font/align_x", fwf->align_x)) {
+ if (!config->get(iniroot + "/font/align_x", fwf->_alignX)) {
for (int i = 0; i < 32; i++) {
- if (fwf->width <= (1 << i)) {
- fwf->align_x = 1 << i;
+ if (fwf->_width <= (1 << i)) {
+ fwf->_alignX = 1 << i;
break;
}
}
}
- if (!config->get(iniroot + "/font/align_y", fwf->align_y)) {
+ if (!config->get(iniroot + "/font/align_y", fwf->_alignY)) {
for (int i = 0; i < 32; i++) {
- if (fwf->height <= (1 << i)) {
- fwf->align_y = 1 << i;
+ if (fwf->_height <= (1 << i)) {
+ fwf->_alignY = 1 << i;
break;
}
}
diff --git a/engines/ultima/ultima8/graphics/fonts/fixed_width_font.h b/engines/ultima/ultima8/graphics/fonts/fixed_width_font.h
index 61dbd28..9ba7b31 100644
--- a/engines/ultima/ultima8/graphics/fonts/fixed_width_font.h
+++ b/engines/ultima/ultima8/graphics/fonts/fixed_width_font.h
@@ -32,12 +32,12 @@ struct Texture;
class IDataSource;
struct FixedWidthFont {
- int width;
- int height;
- int align_x;
- int align_y;
+ int _width;
+ int _height;
+ int _alignX;
+ int _alignY;
- Texture *tex;
+ Texture *_tex;
~FixedWidthFont();
diff --git a/engines/ultima/ultima8/graphics/fonts/font.cpp b/engines/ultima/ultima8/graphics/fonts/font.cpp
index 3d4c35d..43cadcd 100644
--- a/engines/ultima/ultima8/graphics/fonts/font.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/font.cpp
@@ -29,8 +29,7 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE_BASE_CLASS(Font)
-Font::Font() : highRes(false) {
-
+Font::Font() : _highRes(false) {
}
@@ -212,17 +211,17 @@ Std::list<PositionedText> typesetText(Font *font,
// break here
int32 stringwidth = 0, stringheight = 0;
font->getStringSize(curline, stringwidth, stringheight);
- line.dims.x = 0;
- line.dims.y = totalheight;
- line.dims.w = stringwidth;
- line.dims.h = stringheight;
- line.text = curline;
- line.cursor = Std::string::npos;
+ line._dims.x = 0;
+ line._dims.y = totalheight;
+ line._dims.w = stringwidth;
+ line._dims.h = stringheight;
+ line._text = curline;
+ line._cursor = Std::string::npos;
if (cursor != Std::string::npos && cursoriter >= curlinestart &&
(cursoriter < iter || (!breakhere && cursoriter == iter))) {
- line.cursor = cursoriter - curlinestart;
- if (line.dims.w == 0) {
- stringwidth = line.dims.w = 2;
+ line._cursor = cursoriter - curlinestart;
+ if (line._dims.w == 0) {
+ stringwidth = line._dims.w = 2;
}
}
lines.push_back(line);
@@ -347,15 +346,15 @@ Std::list<PositionedText> typesetText(Font *font,
case Font::TEXT_LEFT:
break;
case Font::TEXT_RIGHT:
- lineiter->dims.x = totalwidth - lineiter->dims.w;
+ lineiter->_dims.x = totalwidth - lineiter->_dims.w;
break;
case Font::TEXT_CENTER:
- lineiter->dims.x = (totalwidth - lineiter->dims.w) / 2;
+ lineiter->_dims.x = (totalwidth - lineiter->_dims.w) / 2;
break;
}
#if 0
- pout << lineiter->dims.x << "," << lineiter->dims.y << " "
- << lineiter->dims.w << "," << lineiter->dims.h << ": "
+ pout << lineiter->_dims.x << "," << lineiter->_dims.y << " "
+ << lineiter->_dims.w << "," << lineiter->_dims.h << ": "
<< lineiter->text << Std::endl;
#endif
}
diff --git a/engines/ultima/ultima8/graphics/fonts/font.h b/engines/ultima/ultima8/graphics/fonts/font.h
index 3b4bfeb..b04fe3b 100644
--- a/engines/ultima/ultima8/graphics/fonts/font.h
+++ b/engines/ultima/ultima8/graphics/fonts/font.h
@@ -34,9 +34,9 @@ namespace Ultima8 {
class RenderedText;
struct PositionedText {
- Std::string text;
- Rect dims;
- Std::string::size_type cursor;
+ Std::string _text;
+ Rect _dims;
+ Std::string::size_type _cursor;
};
class Font {
@@ -96,15 +96,14 @@ public:
bool u8specials = false);
void setHighRes(bool hr) {
- highRes = hr;
+ _highRes = hr;
}
bool isHighRes() const {
- return highRes;
+ return _highRes;
}
protected:
- bool highRes;
-
+ bool _highRes;
protected:
diff --git a/engines/ultima/ultima8/graphics/fonts/font_manager.cpp b/engines/ultima/ultima8/graphics/fonts/font_manager.cpp
index a4f8c2f..69f2b1c 100644
--- a/engines/ultima/ultima8/graphics/fonts/font_manager.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/font_manager.cpp
@@ -40,12 +40,12 @@
namespace Ultima {
namespace Ultima8 {
-FontManager *FontManager::fontmanager = 0;
+FontManager *FontManager::_fontManager = 0;
-FontManager::FontManager(bool ttf_antialiasing_) : ttf_antialiasing(ttf_antialiasing_) {
+FontManager::FontManager(bool ttf_antialiasing_) : _ttfAntialiasing(ttf_antialiasing_) {
con->Print(MM_INFO, "Creating Font Manager...\n");
- fontmanager = this;
+ _fontManager = this;
SettingManager *settingman = SettingManager::get_instance();
settingman->setDefault("ttf_highres", true);
@@ -56,50 +56,50 @@ FontManager::~FontManager() {
resetGameFonts();
- for (unsigned int i = 0; i < ttfonts.size(); ++i)
- delete ttfonts[i];
- ttfonts.clear();
+ for (unsigned int i = 0; i < _ttFonts.size(); ++i)
+ delete _ttFonts[i];
+ _ttFonts.clear();
TTFFonts::iterator iter;
- for (iter = ttf_fonts.begin(); iter != ttf_fonts.end(); ++iter)
+ for (iter = _ttfFonts.begin(); iter != _ttfFonts.end(); ++iter)
delete iter->_value;
- ttf_fonts.clear();
+ _ttfFonts.clear();
- assert(fontmanager == this);
- fontmanager = 0;
+ assert(_fontManager == this);
+ _fontManager = 0;
}
// Reset the font manager
void FontManager::resetGameFonts() {
- for (unsigned int i = 0; i < overrides.size(); ++i)
- delete overrides[i];
- overrides.clear();
+ for (unsigned int i = 0; i < _overrides.size(); ++i)
+ delete _overrides[i];
+ _overrides.clear();
}
Font *FontManager::getGameFont(unsigned int fontnum,
bool allowOverride) {
- if (allowOverride && fontnum < overrides.size() && overrides[fontnum])
- return overrides[fontnum];
+ if (allowOverride && fontnum < _overrides.size() && _overrides[fontnum])
+ return _overrides[fontnum];
return GameData::get_instance()->getFonts()->getFont(fontnum);
}
Font *FontManager::getTTFont(unsigned int fontnum) {
- if (fontnum >= ttfonts.size())
+ if (fontnum >= _ttFonts.size())
return 0;
- return ttfonts[fontnum];
+ return _ttFonts[fontnum];
}
Graphics::Font *FontManager::getTTF_Font(Std::string filename, int pointsize) {
TTFId id;
- id.filename = filename;
- id.pointsize = pointsize;
+ id._filename = filename;
+ id._pointSize = pointsize;
TTFFonts::iterator iter;
- iter = ttf_fonts.find(id);
+ iter = _ttfFonts.find(id);
- if (iter != ttf_fonts.end())
+ if (iter != _ttfFonts.end())
return iter->_value;
IDataSource *fontids;
@@ -119,7 +119,7 @@ Graphics::Font *FontManager::getTTF_Font(Std::string filename, int pointsize) {
return 0;
}
- ttf_fonts[id] = font;
+ _ttfFonts[id] = font;
#ifdef DEBUG
pout << "Opened TTF: @data/" << filename << "." << Std::endl;
@@ -129,13 +129,13 @@ Graphics::Font *FontManager::getTTF_Font(Std::string filename, int pointsize) {
}
void FontManager::setOverride(unsigned int fontnum, Font *newFont) {
- if (fontnum >= overrides.size())
- overrides.resize(fontnum + 1);
+ if (fontnum >= _overrides.size())
+ _overrides.resize(fontnum + 1);
- if (overrides[fontnum])
- delete overrides[fontnum];
+ if (_overrides[fontnum])
+ delete _overrides[fontnum];
- overrides[fontnum] = newFont;
+ _overrides[fontnum] = newFont;
}
@@ -146,7 +146,7 @@ bool FontManager::addTTFOverride(unsigned int fontnum, Std::string filename,
if (!f)
return false;
- TTFont *font = new TTFont(f, rgb, bordersize, ttf_antialiasing, SJIS);
+ TTFont *font = new TTFont(f, rgb, bordersize, _ttfAntialiasing, SJIS);
SettingManager *settingman = SettingManager::get_instance();
bool highres;
settingman->get("ttf_highres", highres);
@@ -200,7 +200,7 @@ bool FontManager::loadTTFont(unsigned int fontnum, Std::string filename,
if (!f)
return false;
- TTFont *font = new TTFont(f, rgb, bordersize, ttf_antialiasing, false);
+ TTFont *font = new TTFont(f, rgb, bordersize, _ttfAntialiasing, false);
// TODO: check if this is indeed what we want for non-gamefonts
SettingManager *settingman = SettingManager::get_instance();
@@ -208,13 +208,13 @@ bool FontManager::loadTTFont(unsigned int fontnum, Std::string filename,
settingman->get("ttf_highres", highres);
font->setHighRes(highres);
- if (fontnum >= ttfonts.size())
- ttfonts.resize(fontnum + 1);
+ if (fontnum >= _ttFonts.size())
+ _ttFonts.resize(fontnum + 1);
- if (ttfonts[fontnum])
- delete ttfonts[fontnum];
+ if (_ttFonts[fontnum])
+ delete _ttFonts[fontnum];
- ttfonts[fontnum] = font;
+ _ttFonts[fontnum] = font;
return true;
}
diff --git a/engines/ultima/ultima8/graphics/fonts/font_manager.h b/engines/ultima/ultima8/graphics/fonts/font_manager.h
index bac9b65..69ae5d2 100644
--- a/engines/ultima/ultima8/graphics/fonts/font_manager.h
+++ b/engines/ultima/ultima8/graphics/fonts/font_manager.h
@@ -41,12 +41,12 @@ class TTFont;
class FontManager {
private:
struct TTFId {
- Std::string filename;
- int pointsize;
+ Std::string _filename;
+ int _pointSize;
bool operator<(const TTFId &other) const {
- return (pointsize < other.pointsize ||
- (pointsize == other.pointsize &&
- filename < other.filename));
+ return (_pointSize < other._pointSize ||
+ (_pointSize == other._pointSize &&
+ _filename < other._filename));
}
};
@@ -59,13 +59,13 @@ private:
};
struct TTFEqual {
bool operator()(const TTFId &x, const TTFId &y) const {
- return x.filename == y.filename && x.pointsize == y.pointsize;
+ return x._filename == y._filename && x._pointSize == y._pointSize;
}
};
typedef Std::map<TTFId, Graphics::Font *, TTFHash, TTFEqual> TTFFonts;
- TTFFonts ttf_fonts;
- bool ttf_antialiasing;
+ TTFFonts _ttfFonts;
+ bool _ttfAntialiasing;
//! Get a (possibly cached) TTF_Font structure for filename/pointsize,
//! loading it if necessary.
@@ -74,17 +74,17 @@ private:
//! Override fontnum with specified font
void setOverride(unsigned int fontnum, Font *newFont);
- Std::vector<Font *> overrides;
+ Std::vector<Font *> _overrides;
- Std::vector<Font *> ttfonts;
+ Std::vector<Font *> _ttFonts;
- static FontManager *fontmanager;
+ static FontManager *_fontManager;
public:
FontManager(bool ttf_antialiasing);
~FontManager();
static FontManager *get_instance() {
- return fontmanager;
+ return _fontManager;
}
//! get a Font by fontnum (for game fonts)
diff --git a/engines/ultima/ultima8/graphics/fonts/jp_rendered_text.cpp b/engines/ultima/ultima8/graphics/fonts/jp_rendered_text.cpp
index 295bd67..10937b0 100644
--- a/engines/ultima/ultima8/graphics/fonts/jp_rendered_text.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/jp_rendered_text.cpp
@@ -60,31 +60,31 @@ void JPRenderedText::draw(RenderSurface *surface, int x, int y, bool /*destmaske
Std::list<PositionedText>::iterator iter;
for (iter = lines.begin(); iter != lines.end(); ++iter) {
- int line_x = x + iter->dims.x;
- int line_y = y + iter->dims.y;
+ int line_x = x + iter->_dims.x;
+ int line_y = y + iter->_dims.y;
- size_t textsize = iter->text.size();
+ size_t textsize = iter->_text.size();
for (size_t i = 0; i < textsize; ++i) {
- uint16 sjis = iter->text[i] & 0xFF;
+ uint16 sjis = iter->_text[i] & 0xFF;
if (sjis >= 0x80) {
- uint16 t = iter->text[++i] & 0xFF;
+ uint16 t = iter->_text[++i] & 0xFF;
sjis += (t << 8);
}
uint16 u8char = shiftjis_to_ultima8(sjis);
surface->Paint(font, u8char, line_x, line_y);
- if (i == iter->cursor) {
+ if (i == iter->_cursor) {
surface->Fill32(0xFF000000, line_x, line_y - font->getBaseline(),
- 1, iter->dims.h);
+ 1, iter->_dims.h);
}
line_x += (font->getFrame(u8char))->_width - font->getHlead();
}
- if (iter->cursor == textsize) {
+ if (iter->_cursor == textsize) {
surface->Fill32(0xFF000000, line_x, line_y - font->getBaseline(),
- 1, iter->dims.h);
+ 1, iter->_dims.h);
}
}
@@ -105,15 +105,15 @@ void JPRenderedText::drawBlended(RenderSurface *surface, int x, int y,
Std::list<PositionedText>::iterator iter;
for (iter = lines.begin(); iter != lines.end(); ++iter) {
- int line_x = x + iter->dims.x;
- int line_y = y + iter->dims.y;
+ int line_x = x + iter->_dims.x;
+ int line_y = y + iter->_dims.y;
- size_t textsize = iter->text.size();
+ size_t textsize = iter->_text.size();
for (size_t i = 0; i < textsize; ++i) {
- uint16 sjis = iter->text[i] & 0xFF;
+ uint16 sjis = iter->_text[i] & 0xFF;
if (sjis >= 0x80) {
- uint16 t = iter->text[++i] & 0xFF;
+ uint16 t = iter->_text[++i] & 0xFF;
sjis += (t << 8);
}
uint16 u8char = shiftjis_to_ultima8(sjis);
diff --git a/engines/ultima/ultima8/graphics/fonts/shape_rendered_text.cpp b/engines/ultima/ultima8/graphics/fonts/shape_rendered_text.cpp
index f4ef214..e8eacbc 100644
--- a/engines/ultima/ultima8/graphics/fonts/shape_rendered_text.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/shape_rendered_text.cpp
@@ -51,26 +51,26 @@ void ShapeRenderedText::draw(RenderSurface *surface, int x, int y, bool /*destma
Std::list<PositionedText>::iterator iter;
for (iter = lines.begin(); iter != lines.end(); ++iter) {
- int line_x = x + iter->dims.x;
- int line_y = y + iter->dims.y;
+ int line_x = x + iter->_dims.x;
+ int line_y = y + iter->_dims.y;
- size_t textsize = iter->text.size();
+ size_t textsize = iter->_text.size();
for (size_t i = 0; i < textsize; ++i) {
- surface->Paint(font, static_cast<unsigned char>(iter->text[i]),
+ surface->Paint(font, static_cast<unsigned char>(iter->_text[i]),
line_x, line_y);
- if (i == iter->cursor) {
+ if (i == iter->_cursor) {
surface->Fill32(0xFF000000, line_x, line_y - font->getBaseline(),
- 1, iter->dims.h);
+ 1, iter->_dims.h);
}
- line_x += font->getWidth(iter->text[i]) - font->getHlead();
+ line_x += font->getWidth(iter->_text[i]) - font->getHlead();
}
- if (iter->cursor == textsize) {
+ if (iter->_cursor == textsize) {
surface->Fill32(0xFF000000, line_x, line_y - font->getBaseline(),
- 1, iter->dims.h);
+ 1, iter->_dims.h);
}
}
}
@@ -82,16 +82,16 @@ void ShapeRenderedText::drawBlended(RenderSurface *surface, int x, int y,
Std::list<PositionedText>::iterator iter;
for (iter = lines.begin(); iter != lines.end(); ++iter) {
- int line_x = x + iter->dims.x;
- int line_y = y + iter->dims.y;
+ int line_x = x + iter->_dims.x;
+ int line_y = y + iter->_dims.y;
- size_t textsize = iter->text.size();
+ size_t textsize = iter->_text.size();
for (size_t i = 0; i < textsize; ++i) {
surface->PaintHighlight(font,
- static_cast<unsigned char>(iter->text[i]),
+ static_cast<unsigned char>(iter->_text[i]),
line_x, line_y, false, false, col);
- line_x += font->getWidth(iter->text[i]) - font->getHlead();
+ line_x += font->getWidth(iter->_text[i]) - font->getHlead();
}
}
diff --git a/engines/ultima/ultima8/graphics/fonts/tt_font.cpp b/engines/ultima/ultima8/graphics/fonts/tt_font.cpp
index 3e7efc3..74ca429 100644
--- a/engines/ultima/ultima8/graphics/fonts/tt_font.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/tt_font.cpp
@@ -180,9 +180,9 @@ RenderedText *TTFont::renderText(const Std::string &text,
// convert to unicode
Common::U32String unicodeText;
if (!SJIS)
- unicodeText = toUnicode<Traits>(iter->text, bullet);
+ unicodeText = toUnicode<Traits>(iter->_text, bullet);
else
- unicodeText = toUnicode<SJISTraits>(iter->text, bullet);
+ unicodeText = toUnicode<SJISTraits>(iter->_text, bullet);
// Create a surface and render the text
Graphics::ManagedSurface textSurf;
@@ -202,8 +202,8 @@ RenderedText *TTFont::renderText(const Std::string &text,
};
#if 0
- pout << iter->dims.w << "," << iter->dims.h << " vs. "
- << textSurf.w << "," << textSurf.h << ": " << iter->text
+ pout << iter->_dims.w << "," << iter->_dims.h << " vs. "
+ << textSurf.w << "," << textSurf.h << ": " << iter->_text
<< Std::endl;
#endif
@@ -212,21 +212,21 @@ RenderedText *TTFont::renderText(const Std::string &text,
byte *surfrow = (byte *)textSurf.getBasePtr(0, y);
// CHECKME: bordersize!
- uint32 *bufrow = buf + (iter->dims.y + y + bordersize) * resultwidth;
+ uint32 *bufrow = buf + (iter->_dims.y + y + bordersize) * resultwidth;
for (int x = 0; x < textSurf.w; x++) {
if (!antiAliased && surfrow[x] == 1) {
- bufrow[iter->dims.x + x + bordersize] = rgb | 0xFF000000;
+ bufrow[iter->_dims.x + x + bordersize] = rgb | 0xFF000000;
if (bordersize <= 0) continue;
if (bordersize == 1) {
// optimize common case
for (int dx = -1; dx <= 1; dx++) {
for (int dy = -1; dy <= 1; dy++) {
- if (x + 1 + iter->dims.x + dx >= 0 &&
- x + 1 + iter->dims.x + dx < resultwidth &&
+ if (x + 1 + iter->_dims.x + dx >= 0 &&
+ x + 1 + iter->_dims.x + dx < resultwidth &&
y + 1 + dy >= 0 && y + 1 + dy < resultheight) {
- if (buf[(y + iter->dims.y + dy + 1)*resultwidth + x + 1 + iter->dims.x + dx] == 0) {
- buf[(y + iter->dims.y + dy + 1)*resultwidth + x + 1 + iter->dims.x + dx] = 0xFF000000;
+ if (buf[(y + iter->_dims.y + dy + 1)*resultwidth + x + 1 + iter->_dims.x + dx] == 0) {
+ buf[(y + iter->_dims.y + dy + 1)*resultwidth + x + 1 + iter->_dims.x + dx] = 0xFF000000;
}
}
}
@@ -235,11 +235,11 @@ RenderedText *TTFont::renderText(const Std::string &text,
}
for (int dx = -bordersize; dx <= bordersize; dx++) {
for (int dy = -bordersize; dy <= bordersize; dy++) {
- if (x + bordersize + iter->dims.x + dx >= 0 &&
- x + bordersize + iter->dims.x + dx < resultwidth &&
+ if (x + bordersize + iter->_dims.x + dx >= 0 &&
+ x + bordersize + iter->_dims.x + dx < resultwidth &&
y + bordersize + dy >= 0 && y + bordersize + dy < resultheight) {
- if (buf[(y + iter->dims.y + dy + bordersize)*resultwidth + x + bordersize + iter->dims.x + dx] == 0) {
- buf[(y + iter->dims.y + dy + bordersize)*resultwidth + x + bordersize + iter->dims.x + dx] = 0xFF000000;
+ if (buf[(y + iter->_dims.y + dy + bordersize)*resultwidth + x + bordersize + iter->_dims.x + dx] == 0) {
+ buf[(y + iter->_dims.y + dy + bordersize)*resultwidth + x + bordersize + iter->_dims.x + dx] = 0xFF000000;
}
}
}
@@ -254,33 +254,33 @@ RenderedText *TTFont::renderText(const Std::string &text,
int idx = pixA;
if (bordersize <= 0) {
- bufrow[iter->dims.x + x + bordersize] = TEX32_PACK_RGBA(pixR, pixG, pixB, pixA);
+ bufrow[iter->_dims.x + x + bordersize] = TEX32_PACK_RGBA(pixR, pixG, pixB, pixA);
} else {
- bufrow[iter->dims.x + x + bordersize] = TEX32_PACK_RGBA(pixR, pixG, pixB, 0xFF);
+ bufrow[iter->_dims.x + x + bordersize] = TEX32_PACK_RGBA(pixR, pixG, pixB, 0xFF);
// optimize common case
if (bordersize == 1) for (int dx = -1; dx <= 1; dx++) {
for (int dy = -1; dy <= 1; dy++) {
- if (x + 1 + iter->dims.x + dx >= 0 &&
- x + 1 + iter->dims.x + dx < resultwidth &&
+ if (x + 1 + iter->_dims.x + dx >= 0 &&
+ x + 1 + iter->_dims.x + dx < resultwidth &&
y + 1 + dy >= 0 && y + 1 + dy < resultheight) {
- uint32 alpha = TEX32_A(buf[(y + iter->dims.y + dy + 1) * resultwidth + x + 1 + iter->dims.x + dx]);
+ uint32 alpha = TEX32_A(buf[(y + iter->_dims.y + dy + 1) * resultwidth + x + 1 + iter->_dims.x + dx]);
if (alpha != 0xFF) {
alpha = 255 - (((255 - alpha) * (255 - idx)) >> 8);
- buf[(y + iter->dims.y + dy + 1)*resultwidth + x + 1 + iter->dims.x + dx] = alpha << TEX32_A_SHIFT;
+ buf[(y + iter->_dims.y + dy + 1)*resultwidth + x + 1 + iter->_dims.x + dx] = alpha << TEX32_A_SHIFT;
}
}
}
} else {
for (int dx = -bordersize; dx <= bordersize; dx++) {
for (int dy = -bordersize; dy <= bordersize; dy++) {
- if (x + bordersize + iter->dims.x + dx >= 0 &&
- x + bordersize + iter->dims.x + dx < resultwidth &&
+ if (x + bordersize + iter->_dims.x + dx >= 0 &&
+ x + bordersize + iter->_dims.x + dx < resultwidth &&
y + bordersize + dy >= 0 && y + bordersize + dy < resultheight) {
- uint32 alpha = TEX32_A(buf[(y + iter->dims.y + dy + bordersize) * resultwidth + x + bordersize + iter->dims.x + dx]);
+ uint32 alpha = TEX32_A(buf[(y + iter->_dims.y + dy + bordersize) * resultwidth + x + bordersize + iter->_dims.x + dx]);
if (alpha != 0xFF) {
alpha = 255 - (((255 - alpha) * (255 - idx)) >> 8);
- buf[(y + iter->dims.y + dy + bordersize)*resultwidth + x + bordersize + iter->dims.x + dx] = alpha << TEX32_A_SHIFT;
+ buf[(y + iter->_dims.y + dy + bordersize)*resultwidth + x + bordersize + iter->_dims.x + dx] = alpha << TEX32_A_SHIFT;
}
}
}
@@ -291,17 +291,17 @@ RenderedText *TTFont::renderText(const Std::string &text,
}
}
- if (iter->cursor != Std::string::npos) {
- assert(iter->cursor <= iter->text.size());
- unicodeText = Common::U32String(unicodeText.c_str(), iter->cursor);
+ if (iter->_cursor != Std::string::npos) {
+ assert(iter->_cursor <= iter->_text.size());
+ unicodeText = Common::U32String(unicodeText.c_str(), iter->_cursor);
int w = ttf_font->getStringWidth(unicodeText);
- for (int y = 0; y < iter->dims.h; y++) {
- uint32 *bufrow = buf + (iter->dims.y + y) * resultwidth;
- bufrow[iter->dims.x + w + bordersize] = 0xFF000000;
+ for (int y = 0; y < iter->_dims.h; y++) {
+ uint32 *bufrow = buf + (iter->_dims.y + y) * resultwidth;
+ bufrow[iter->_dims.x + w + bordersize] = 0xFF000000;
// if (bordersize > 0)
-// bufrow[iter->dims.x+w+bordersize-1] = 0xFF000000;
+// bufrow[iter->_dims.x+w+bordersize-1] = 0xFF000000;
}
}
}
diff --git a/engines/ultima/ultima8/graphics/soft_render_surface.cpp b/engines/ultima/ultima8/graphics/soft_render_surface.cpp
index 6503894..5be6d1f 100644
--- a/engines/ultima/ultima8/graphics/soft_render_surface.cpp
+++ b/engines/ultima/ultima8/graphics/soft_render_surface.cpp
@@ -334,13 +334,13 @@ template<class uintX> void SoftRenderSurface<uintX>::DrawLine32(uint32 rgb, int3
//
// Desc: Blit a region from a Texture (Alpha == 0 -> skipped)
//
-template<class uintX> void SoftRenderSurface<uintX>::Blit(Texture *tex, int32 sx, int32 sy, int32 w, int32 h, int32 dx, int32 dy, bool alpha_blend) {
+template<class uintX> void SoftRenderSurface<uintX>::Blit(Texture *_tex, int32 sx, int32 sy, int32 w, int32 h, int32 dx, int32 dy, bool alpha_blend) {
// Clamp or wrap or return?
- if (sx + w > static_cast<int32>(tex->_width))
+ if (sx + w > static_cast<int32>(_tex->_width))
return;
// Clamp or wrap or return?
- if (sy + h > static_cast<int32>(tex->_height))
+ if (sy + h > static_cast<int32>(_tex->_height))
return;
if (sx < 0 || sy < 0)
@@ -360,9 +360,9 @@ template<class uintX> void SoftRenderSurface<uintX>::Blit(Texture *tex, int32 sx
uint8 *end = pixel + h * _pitch;
int diff = _pitch - w * sizeof(uintX);
- if (tex->_format == TEX_FMT_STANDARD) {
- uint32 *texel = tex->_buffer + (sy * tex->_width + sx);
- int tex_diff = tex->_width - w;
+ if (_tex->_format == TEX_FMT_STANDARD) {
+ uint32 *texel = _tex->_buffer + (sy * _tex->_width + sx);
+ int tex_diff = _tex->_width - w;
while (pixel != end) {
if (!alpha_blend) while (pixel != line_end) {
@@ -388,9 +388,9 @@ template<class uintX> void SoftRenderSurface<uintX>::Blit(Texture *tex, int32 sx
pixel += diff;
texel += tex_diff;
}
- } else if (tex->_format == TEX_FMT_NATIVE) {
- uintX *texel = reinterpret_cast<uintX *>(tex->_buffer) + (sy * tex->_width + sx);
- int tex_diff = tex->_width - w;
+ } else if (_tex->_format == TEX_FMT_NATIVE) {
+ uintX *texel = reinterpret_cast<uintX *>(_tex->_buffer) + (sy * _tex->_width + sx);
+ int tex_diff = _tex->_width - w;
while (pixel != end) {
while (pixel != line_end) {
@@ -412,19 +412,19 @@ template<class uintX> void SoftRenderSurface<uintX>::Blit(Texture *tex, int32 sx
/* Old complete code
// Clamp or wrap or return?
#ifndef BLIT_WRAP
- if (w > static_cast<int32>(tex->_width))
+ if (w > static_cast<int32>(_tex->_width))
#ifndef BLIT_CLIP
return;
#else
- w = tex->_width;
+ w = _tex->_width;
#endif
// Clamp or wrap or return?
- if (h > static_cast<int32>(tex->_height))
+ if (h > static_cast<int32>(_tex->_height))
#ifndef BLIT_CLIP
return;
#else
- h = tex->_height;
+ h = _tex->_height;
#endif
#endif
@@ -442,14 +442,14 @@ template<class uintX> void SoftRenderSurface<uintX>::Blit(Texture *tex, int32 sx
uint8 *end = pixel + h * _pitch;
int diff = _pitch - w*sizeof(uintX);
- uint32 *texel = tex->_buffer + (sy * tex->_width + sx);
+ uint32 *texel = _tex->_buffer + (sy * _tex->_width + sx);
#ifdef BLIT_WRAP
- uint32 *texel_line_start = tex->_buffer + sy * tex->_width;
- uint32 *texel_line_end = tex->_buffer + (sy+1) * tex->_width;
- uint32 *texel_col_start = tex->_buffer + sx;
- uint32 *texel_col_end = tex->_buffer + (tex->_height * tex->_width + sx);
+ uint32 *texel_line_start = _tex->_buffer + sy * _tex->_width;
+ uint32 *texel_line_end = _tex->_buffer + (sy+1) * _tex->_width;
+ uint32 *texel_col_start = _tex->_buffer + sx;
+ uint32 *texel_col_end = _tex->_buffer + (_tex->_height * _tex->_width + sx);
#endif
- int tex_diff = tex->_width - w;
+ int tex_diff = _tex->_width - w;
//b = PACK_RGB8( (rgb>>16)&0xFF , (rgb>>8)&0xFF , rgb&0xFF );
@@ -487,13 +487,13 @@ template<class uintX> void SoftRenderSurface<uintX>::Blit(Texture *tex, int32 sx
//
// Desc: Blit a region from a Texture (Alpha == 0 -> skipped)
//
-template<class uintX> void SoftRenderSurface<uintX>::FadedBlit(Texture *tex, int32 sx, int32 sy, int32 w, int32 h, int32 dx, int32 dy, uint32 col32, bool alpha_blend) {
+template<class uintX> void SoftRenderSurface<uintX>::FadedBlit(Texture *_tex, int32 sx, int32 sy, int32 w, int32 h, int32 dx, int32 dy, uint32 col32, bool alpha_blend) {
// Clamp or wrap or return?
- if (w > static_cast<int32>(tex->_width))
+ if (w > static_cast<int32>(_tex->_width))
return;
// Clamp or wrap or return?
- if (h > static_cast<int32>(tex->_height))
+ if (h > static_cast<int32>(_tex->_height))
return;
// Clip to window
@@ -516,9 +516,9 @@ template<class uintX> void SoftRenderSurface<uintX>::FadedBlit(Texture *tex, int
uint32 g = (TEX32_G(col32) * a);
uint32 b = (TEX32_B(col32) * a);
- if (tex->_format == TEX_FMT_STANDARD) {
- uint32 *texel = tex->_buffer + (sy * tex->_width + sx);
- int tex_diff = tex->_width - w;
+ if (_tex->_format == TEX_FMT_STANDARD) {
+ uint32 *texel = _tex->_buffer + (sy * _tex->_width + sx);
+ int tex_diff = _tex->_width - w;
while (pixel != end) {
if (!alpha_blend) while (pixel != line_end) {
@@ -568,9 +568,9 @@ template<class uintX> void SoftRenderSurface<uintX>::FadedBlit(Texture *tex, int
pixel += diff;
texel += tex_diff;
}
- } else if (tex->_format == TEX_FMT_NATIVE) {
- uintX *texel = reinterpret_cast<uintX *>(tex->_buffer) + (sy * tex->_width + sx);
- int tex_diff = tex->_width - w;
+ } else if (_tex->_format == TEX_FMT_NATIVE) {
+ uintX *texel = reinterpret_cast<uintX *>(_tex->_buffer) + (sy * _tex->_width + sx);
+ int tex_diff = _tex->_width - w;
while (pixel != end) {
while (pixel != line_end) {
@@ -597,13 +597,13 @@ template<class uintX> void SoftRenderSurface<uintX>::FadedBlit(Texture *tex, int
// Desc Blit a region from a Texture with a Colour blend masked based on DestAlpha (AlphaTex == 0 || AlphaDest == 0 -> skipped. AlphaCol32 -> Blend Factors)
//
//
-template<class uintX> void SoftRenderSurface<uintX>::MaskedBlit(Texture *tex, int32 sx, int32 sy, int32 w, int32 h, int32 dx, int32 dy, uint32 col32, bool alpha_blend) {
+template<class uintX> void SoftRenderSurface<uintX>::MaskedBlit(Texture *_tex, int32 sx, int32 sy, int32 w, int32 h, int32 dx, int32 dy, uint32 col32, bool alpha_blend) {
// Clamp or wrap or return?
- if (w > static_cast<int32>(tex->_width))
+ if (w > static_cast<int32>(_tex->_width))
return;
// Clamp or wrap or return?
- if (h > static_cast<int32>(tex->_height))
+ if (h > static_cast<int32>(_tex->_height))
return;
// Clip to window
@@ -626,9 +626,9 @@ template<class uintX> void SoftRenderSurface<uintX>::MaskedBlit(Texture *tex, in
uint32 g = (TEX32_G(col32) * a);
uint32 b = (TEX32_B(col32) * a);
- if (tex->_format == TEX_FMT_STANDARD) {
- uint32 *texel = tex->_buffer + (sy * tex->_width + sx);
- int tex_diff = tex->_width - w;
+ if (_tex->_format == TEX_FMT_STANDARD) {
+ uint32 *texel = _tex->_buffer + (sy * _tex->_width + sx);
+ int tex_diff = _tex->_width - w;
while (pixel != end) {
if (!alpha_blend) while (pixel != line_end) {
@@ -682,9 +682,9 @@ template<class uintX> void SoftRenderSurface<uintX>::MaskedBlit(Texture *tex, in
pixel += diff;
texel += tex_diff;
}
- } else if (tex->_format == TEX_FMT_NATIVE) {
- uintX *texel = reinterpret_cast<uintX *>(tex->_buffer) + (sy * tex->_width + sx);
- int tex_diff = tex->_width - w;
+ } else if (_tex->_format == TEX_FMT_NATIVE) {
+ uintX *texel = reinterpret_cast<uintX *>(_tex->_buffer) + (sy * _tex->_width + sx);
+ int tex_diff = _tex->_width - w;
while (pixel != end) {
while (pixel != line_end) {
@@ -760,11 +760,11 @@ template<class uintX> bool SoftRenderSurface<uintX>::ScalerBlit(Texture *texture
template<class uintX> void SoftRenderSurface<uintX>::PrintCharFixed(FixedWidthFont *font, int character, int x, int y) {
if (character == ' ') return; // Don't paint spaces
- int align_x = font->align_x;
- int align_y = font->align_y;
- int char_width = font->width;
- int char_height = font->height;
- Texture *texture = font->tex;
+ int align_x = font->_alignX;
+ int align_y = font->_alignY;
+ int char_width = font->_width;
+ int char_height = font->_height;
+ Texture *texture = font->_tex;
if (align_x == 16 && align_y == 16) {
SoftRenderSurface::Blit(texture, (character & 0x0F) << 4, character & 0xF0, char_width, char_height, x, y);
@@ -782,11 +782,11 @@ template<class uintX> void SoftRenderSurface<uintX>::PrintCharFixed(FixedWidthFo
// Desc: Draw fixed width from a Texture buffer (16x16 characters fixed width and height)
//
template<class uintX> void SoftRenderSurface<uintX>::PrintTextFixed(FixedWidthFont *font, const char *text, int x, int y) {
- int align_x = font->align_x;
- int align_y = font->align_y;
- int char_width = font->width;
- int char_height = font->height;
- Texture *texture = font->tex;
+ int align_x = font->_alignX;
+ int align_y = font->_alignY;
+ int char_width = font->_width;
+ int char_height = font->_height;
+ Texture *texture = font->_tex;
int character;
if (align_x == 16 && align_y == 16) while (0 != (character = *text)) {
diff --git a/engines/ultima/ultima8/misc/console.cpp b/engines/ultima/ultima8/misc/console.cpp
index 23a0f25..4684682 100644
--- a/engines/ultima/ultima8/misc/console.cpp
+++ b/engines/ultima/ultima8/misc/console.cpp
@@ -171,7 +171,7 @@ void Console::CheckResize(int scrwidth) {
if (!_conFont)
width = (scrwidth >> 3) - 2;
else
- width = (scrwidth / _conFont->width) - 2;
+ width = (scrwidth / _conFont->_width) - 2;
if (width == _lineWidth)
return;
@@ -800,23 +800,23 @@ void Console::DrawConsole(RenderSurface *surf, int height) {
y = lines - 24;
#else
- rows = (lines / _conFont->height) - 2; // rows of _text to draw
+ rows = (lines / _conFont->_height) - 2; // rows of _text to draw
- y = lines - (_conFont->height * 3);
+ y = lines - (_conFont->_height * 3);
#endif
// draw from the bottom up
if (_display != _current) {
// draw arrows to show the buffer is backscrolled
for (x = 0 ; x < _lineWidth ; x += 4)
- surf->PrintCharFixed(_conFont, '^', (x + 1) * _conFont->width, y);
+ surf->PrintCharFixed(_conFont, '^', (x + 1) * _conFont->_width, y);
- y -= _conFont->height;
+ y -= _conFont->_height;
rows--;
}
row = _display;
- for (i = 0 ; i < rows ; i++, y -= _conFont->height, row--) {
+ for (i = 0 ; i < rows ; i++, y -= _conFont->_height, row--) {
if (row < 0)
break;
if (_current - row >= _totalLines)
@@ -825,7 +825,7 @@ void Console::DrawConsole(RenderSurface *surf, int height) {
char *txt = _text + (row % _totalLines) * _lineWidth;
for (x = 0 ; x < _lineWidth ; x++) {
- surf->PrintCharFixed(_conFont, txt[x], (x + 1)*_conFont->width, y);
+ surf->PrintCharFixed(_conFont, txt[x], (x + 1)*_conFont->_width, y);
// putchar (txt[x]);
}
//putchar ('\n');
@@ -845,20 +845,20 @@ void Console::DrawConsole(RenderSurface *surf, int height) {
cur_pos = _lineWidth - 2;
}
- y = lines - (_conFont->height * 2);
+ y = lines - (_conFont->_height * 2);
- surf->PrintCharFixed(_conFont, ']', _conFont->width, y);
+ surf->PrintCharFixed(_conFont, ']', _conFont->_width, y);
for (x = 0 ; x < (_lineWidth - 2) && com[x]; x++) {
- surf->PrintCharFixed(_conFont, com[x], (x + 2)*_conFont->width, y);
+ surf->PrintCharFixed(_conFont, com[x], (x + 2)*_conFont->_width, y);
// putchar (txt[x]);
}
// Now for cursor position
if (commandInsert)
- surf->Fill32(0xFFFFFFFF, ((cur_pos + 2)*_conFont->width) + 1, y, 2, _conFont->height);
+ surf->Fill32(0xFFFFFFFF, ((cur_pos + 2)*_conFont->_width) + 1, y, 2, _conFont->_height);
else
- surf->Fill32(0xFFFFFFFF, ((cur_pos + 2)*_conFont->width) + 1, y + _conFont->height - 2, _conFont->width, 2);
+ surf->Fill32(0xFFFFFFFF, ((cur_pos + 2)*_conFont->_width) + 1, y + _conFont->_height - 2, _conFont->_width, 2);
}
@@ -881,9 +881,9 @@ void Console::DrawConsoleNotify(RenderSurface *surf) {
txt = _text + (i % _totalLines) * _lineWidth;
for (x = 0 ; x < con->_lineWidth ; x++)
- surf->PrintCharFixed(_conFont, txt[x], (x + 1)*_conFont->width, v);
+ surf->PrintCharFixed(_conFont, txt[x], (x + 1)*_conFont->_width, v);
- v += _conFont->height;
+ v += _conFont->_height;
}
}
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index 08b4844..2a1d014 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -855,7 +855,7 @@ void Ultima8Engine::paint() {
char buf[256] = { '\0' };
FixedWidthFont *confont = con->GetConFont();
int v_offset = 0;
- int char_w = confont->width;
+ int char_w = confont->_width;
if (tdiff >= 250) {
diff = tdiff / t;
@@ -868,15 +868,15 @@ void Ultima8Engine::paint() {
snprintf(buf, 255, "Rendering time %li ms %li FPS ", diff, fps);
_screen->PrintTextFixed(confont, buf, dims.w - char_w * strlen(buf), v_offset);
- v_offset += confont->height;
+ v_offset += confont->_height;
snprintf(buf, 255, "Paint Gumps %li ms ", paint);
_screen->PrintTextFixed(confont, buf, dims.w - char_w * strlen(buf), v_offset);
- v_offset += confont->height;
+ v_offset += confont->_height;
snprintf(buf, 255, "t %02d:%02d gh %i ", I_getTimeInMinutes(0, 0), I_getTimeInSeconds(0, 0) % 60, I_getTimeInGameHours(0, 0));
_screen->PrintTextFixed(confont, buf, dims.w - char_w * strlen(buf), v_offset);
- v_offset += confont->height;
+ v_offset += confont->_height;
}
// End _painting
Commit: 816a1a9da39ba1af2fe38ae2184cb5bfdc393376
https://github.com/scummvm/scummvm/commit/816a1a9da39ba1af2fe38ae2184cb5bfdc393376
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-17T19:42:21-08:00
Commit Message:
ULTIMA8: Renaming font classes fields
Changed paths:
engines/ultima/ultima8/graphics/fonts/jp_font.cpp
engines/ultima/ultima8/graphics/fonts/jp_font.h
engines/ultima/ultima8/graphics/fonts/jp_rendered_text.cpp
engines/ultima/ultima8/graphics/fonts/jp_rendered_text.h
engines/ultima/ultima8/graphics/fonts/rendered_text.cpp
engines/ultima/ultima8/graphics/fonts/rendered_text.h
engines/ultima/ultima8/graphics/fonts/shape_font.cpp
engines/ultima/ultima8/graphics/fonts/shape_font.h
engines/ultima/ultima8/graphics/fonts/shape_rendered_text.cpp
engines/ultima/ultima8/graphics/fonts/shape_rendered_text.h
engines/ultima/ultima8/graphics/fonts/tt_font.cpp
engines/ultima/ultima8/graphics/fonts/tt_font.h
engines/ultima/ultima8/graphics/fonts/ttf_rendered_text.cpp
engines/ultima/ultima8/graphics/fonts/ttf_rendered_text.h
diff --git a/engines/ultima/ultima8/graphics/fonts/jp_font.cpp b/engines/ultima/ultima8/graphics/fonts/jp_font.cpp
index 9a7d93a..10ca0a4 100644
--- a/engines/ultima/ultima8/graphics/fonts/jp_font.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/jp_font.cpp
@@ -35,34 +35,33 @@ DEFINE_RUNTIME_CLASSTYPE_CODE(JPFont, Font)
JPFont::JPFont(ShapeFont *jpfont, unsigned int fontnum_)
- : fontnum(fontnum_), shapefont(jpfont) {
- assert(shapefont->frameCount() > 256);
+ : _fontNum(fontnum_), _shapeFont(jpfont) {
+ assert(_shapeFont->frameCount() > 256);
}
JPFont::~JPFont() {
-
}
int JPFont::getWidth(int c) {
- return shapefont->getFrame(c)->_width;
+ return _shapeFont->getFrame(c)->_width;
}
int JPFont::getHeight() {
- return shapefont->getHeight();
+ return _shapeFont->getHeight();
}
int JPFont::getBaseline() {
- return shapefont->getBaseline();
+ return _shapeFont->getBaseline();
}
int JPFont::getBaselineSkip() {
- return shapefont->getBaselineSkip();
+ return _shapeFont->getBaselineSkip();
}
void JPFont::getStringSize(const Std::string &text, int32 &width, int32 &height) {
- int hlead = shapefont->getHlead();
+ int hlead = _shapeFont->getHlead();
width = hlead;
height = getHeight();
@@ -104,7 +103,7 @@ RenderedText *JPFont::renderText(const Std::string &text,
cursor);
return new JPRenderedText(lines, resultwidth, resultheight,
- shapefont->getVlead(), shapefont, fontnum);
+ _shapeFont->getVlead(), _shapeFont, _fontNum);
}
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/graphics/fonts/jp_font.h b/engines/ultima/ultima8/graphics/fonts/jp_font.h
index 88eab41..a67ae02 100644
--- a/engines/ultima/ultima8/graphics/fonts/jp_font.h
+++ b/engines/ultima/ultima8/graphics/fonts/jp_font.h
@@ -56,8 +56,8 @@ public:
ENABLE_RUNTIME_CLASSTYPE()
protected:
- unsigned int fontnum;
- ShapeFont *shapefont;
+ unsigned int _fontNum;
+ ShapeFont *_shapeFont;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/graphics/fonts/jp_rendered_text.cpp b/engines/ultima/ultima8/graphics/fonts/jp_rendered_text.cpp
index 10937b0..1926fd6 100644
--- a/engines/ultima/ultima8/graphics/fonts/jp_rendered_text.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/jp_rendered_text.cpp
@@ -34,17 +34,15 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(JPRenderedText, RenderedText)
-JPRenderedText::JPRenderedText(Std::list<PositionedText> &lines_,
- int width_, int height_, int vlead_,
- ShapeFont *font_, unsigned int fontnum_)
- : lines(lines_), font(font_), fontnum(fontnum_) {
- width = width_;
- height = height_;
- vlead = vlead_;
+JPRenderedText::JPRenderedText(Std::list<PositionedText> &lines, int width, int height,
+ int vLead, ShapeFont *font, unsigned int fontNum)
+ : _lines(lines), _font(font), _fontNum(fontNum) {
+ _width = width;
+ _height = height;
+ _vLead = vLead;
}
JPRenderedText::~JPRenderedText() {
-
}
void JPRenderedText::draw(RenderSurface *surface, int x, int y, bool /*destmasked*/) {
@@ -52,14 +50,14 @@ void JPRenderedText::draw(RenderSurface *surface, int x, int y, bool /*destmaske
PaletteManager *palman = PaletteManager::get_instance();
PaletteManager::PalIndex fontpal = static_cast<PaletteManager::PalIndex>
- (PaletteManager::Pal_JPFontStart + fontnum);
+ (PaletteManager::Pal_JPFontStart + _fontNum);
Palette *pal = palman->getPalette(fontpal);
- const Palette *savepal = font->getPalette();
- font->setPalette(pal);
+ const Palette *savepal = _font->getPalette();
+ _font->setPalette(pal);
Std::list<PositionedText>::iterator iter;
- for (iter = lines.begin(); iter != lines.end(); ++iter) {
+ for (iter = _lines.begin(); iter != _lines.end(); ++iter) {
int line_x = x + iter->_dims.x;
int line_y = y + iter->_dims.y;
@@ -72,23 +70,23 @@ void JPRenderedText::draw(RenderSurface *surface, int x, int y, bool /*destmaske
sjis += (t << 8);
}
uint16 u8char = shiftjis_to_ultima8(sjis);
- surface->Paint(font, u8char, line_x, line_y);
+ surface->Paint(_font, u8char, line_x, line_y);
if (i == iter->_cursor) {
- surface->Fill32(0xFF000000, line_x, line_y - font->getBaseline(),
+ surface->Fill32(0xFF000000, line_x, line_y - _font->getBaseline(),
1, iter->_dims.h);
}
- line_x += (font->getFrame(u8char))->_width - font->getHlead();
+ line_x += (_font->getFrame(u8char))->_width - _font->getHlead();
}
if (iter->_cursor == textsize) {
- surface->Fill32(0xFF000000, line_x, line_y - font->getBaseline(),
+ surface->Fill32(0xFF000000, line_x, line_y - _font->getBaseline(),
1, iter->_dims.h);
}
}
- font->setPalette(savepal);
+ _font->setPalette(savepal);
}
void JPRenderedText::drawBlended(RenderSurface *surface, int x, int y,
@@ -97,14 +95,14 @@ void JPRenderedText::drawBlended(RenderSurface *surface, int x, int y,
PaletteManager *palman = PaletteManager::get_instance();
PaletteManager::PalIndex fontpal = static_cast<PaletteManager::PalIndex>
- (PaletteManager::Pal_JPFontStart + fontnum);
+ (PaletteManager::Pal_JPFontStart + _fontNum);
Palette *pal = palman->getPalette(fontpal);
- const Palette *savepal = font->getPalette();
- font->setPalette(pal);
+ const Palette *savepal = _font->getPalette();
+ _font->setPalette(pal);
Std::list<PositionedText>::iterator iter;
- for (iter = lines.begin(); iter != lines.end(); ++iter) {
+ for (iter = _lines.begin(); iter != _lines.end(); ++iter) {
int line_x = x + iter->_dims.x;
int line_y = y + iter->_dims.y;
@@ -118,14 +116,14 @@ void JPRenderedText::drawBlended(RenderSurface *surface, int x, int y,
}
uint16 u8char = shiftjis_to_ultima8(sjis);
- surface->PaintHighlight(font, u8char, line_x, line_y,
+ surface->PaintHighlight(_font, u8char, line_x, line_y,
false, false, col);
- line_x += (font->getFrame(u8char))->_width - font->getHlead();
+ line_x += (_font->getFrame(u8char))->_width - _font->getHlead();
}
}
- font->setPalette(savepal);
+ _font->setPalette(savepal);
}
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/graphics/fonts/jp_rendered_text.h b/engines/ultima/ultima8/graphics/fonts/jp_rendered_text.h
index bc156be..30f2582 100644
--- a/engines/ultima/ultima8/graphics/fonts/jp_rendered_text.h
+++ b/engines/ultima/ultima8/graphics/fonts/jp_rendered_text.h
@@ -45,9 +45,9 @@ public:
ENABLE_RUNTIME_CLASSTYPE()
protected:
- Std::list<PositionedText> lines;
- ShapeFont *font;
- unsigned int fontnum;
+ Std::list<PositionedText> _lines;
+ ShapeFont *_font;
+ unsigned int _fontNum;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/graphics/fonts/rendered_text.cpp b/engines/ultima/ultima8/graphics/fonts/rendered_text.cpp
index 7ea6c75..c899f82 100644
--- a/engines/ultima/ultima8/graphics/fonts/rendered_text.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/rendered_text.cpp
@@ -29,7 +29,7 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE_BASE_CLASS(RenderedText)
RenderedText::RenderedText()
- : width(-1), height(-1), vlead(0) {
+ : _width(-1), _height(-1), _vLead(0) {
}
diff --git a/engines/ultima/ultima8/graphics/fonts/rendered_text.h b/engines/ultima/ultima8/graphics/fonts/rendered_text.h
index 2489cb9..23ef550 100644
--- a/engines/ultima/ultima8/graphics/fonts/rendered_text.h
+++ b/engines/ultima/ultima8/graphics/fonts/rendered_text.h
@@ -48,20 +48,20 @@ public:
//! \param x Returns the width
//! \param y Returns the height
virtual void getSize(int &x, int &y) {
- x = width;
- y = height;
+ x = _width;
+ y = _height;
}
//! Get vlead
virtual int getVlead() {
- return vlead;
+ return _vLead;
}
ENABLE_RUNTIME_CLASSTYPE_BASE()
protected:
- int width, height;
- int vlead;
+ int _width, _height;
+ int _vLead;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/graphics/fonts/shape_font.cpp b/engines/ultima/ultima8/graphics/fonts/shape_font.cpp
index 0529d6b..09f7d43 100644
--- a/engines/ultima/ultima8/graphics/fonts/shape_font.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/shape_font.cpp
@@ -36,12 +36,10 @@ ShapeFont::ShapeFont(const uint8 *data_, uint32 size_,
const ConvertShapeFormat *format,
const uint16 flexId_, const uint32 shapeNum_)
: Font(), Shape(data_, size_, format, flexId_, shapeNum_),
- height(0), baseline(0), vlead(-1), hlead(0) {
-
+ _height(0), _baseLine(0), _vLead(-1), _hLead(0) {
}
ShapeFont::~ShapeFont() {
-
}
@@ -50,27 +48,27 @@ int ShapeFont::getWidth(char c) {
}
int ShapeFont::getHeight() {
- if (height == 0) {
+ if (_height == 0) {
for (uint32 i = 0; i < frameCount(); i++) {
int h = getFrame(i)->_height;
- if (h > height) height = h;
+ if (h > _height) _height = h;
}
}
- return height;
+ return _height;
}
int ShapeFont::getBaseline() {
- if (baseline == 0) {
+ if (_baseLine == 0) {
for (uint32 i = 0; i < frameCount(); i++) {
int b = getFrame(i)->_yoff;
- if (b > baseline) baseline = b;
+ if (b > _baseLine) _baseLine = b;
}
}
- return baseline;
+ return _baseLine;
}
int ShapeFont::getBaselineSkip() {
@@ -78,14 +76,14 @@ int ShapeFont::getBaselineSkip() {
}
void ShapeFont::getStringSize(const Std::string &text, int32 &width, int32 &height_) {
- width = hlead;
+ width = _hLead;
height_ = getHeight();
for (unsigned int i = 0; i < text.size(); ++i) {
if (text[i] == '\n' || text[i] == '\r') {
// ignore
} else {
- width += getWidth(text[i]) - hlead;
+ width += getWidth(text[i]) - _hLead;
}
}
}
diff --git a/engines/ultima/ultima8/graphics/fonts/shape_font.h b/engines/ultima/ultima8/graphics/fonts/shape_font.h
index dc7d724..417cce0 100644
--- a/engines/ultima/ultima8/graphics/fonts/shape_font.h
+++ b/engines/ultima/ultima8/graphics/fonts/shape_font.h
@@ -31,10 +31,10 @@ namespace Ultima {
namespace Ultima8 {
class ShapeFont : public Font, public Shape {
- int height;
- int baseline;
- int vlead;
- int hlead;
+ int _height;
+ int _baseLine;
+ int _vLead;
+ int _hLead;
public:
ShapeFont(const uint8 *data, uint32 size, const ConvertShapeFormat *format,
@@ -47,17 +47,17 @@ public:
int getWidth(char c);
int getVlead() const {
- return vlead;
+ return _vLead;
}
int getHlead() const {
- return hlead;
+ return _hLead;
}
void setVLead(int vl) {
- vlead = vl;
+ _vLead = vl;
}
void setHLead(int hl) {
- hlead = hl;
+ _hLead = hl;
}
void getStringSize(const Std::string &text,
diff --git a/engines/ultima/ultima8/graphics/fonts/shape_rendered_text.cpp b/engines/ultima/ultima8/graphics/fonts/shape_rendered_text.cpp
index e8eacbc..8fa80c6 100644
--- a/engines/ultima/ultima8/graphics/fonts/shape_rendered_text.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/shape_rendered_text.cpp
@@ -32,17 +32,16 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(ShapeRenderedText, RenderedText)
-ShapeRenderedText::ShapeRenderedText(Std::list<PositionedText> &lines_,
- int width_, int height_, int vlead_,
- ShapeFont *font_)
- : lines(lines_), font(font_) {
- width = width_;
- height = height_;
- vlead = vlead_;
+ShapeRenderedText::ShapeRenderedText(Std::list<PositionedText> &_lines,
+ int width_, int height, int vLead,
+ ShapeFont *_font)
+ : _lines(_lines), _font(_font) {
+ _width = width_;
+ _height = height;
+ _vLead = vLead;
}
ShapeRenderedText::~ShapeRenderedText() {
-
}
void ShapeRenderedText::draw(RenderSurface *surface, int x, int y, bool /*destmasked*/) {
@@ -50,26 +49,26 @@ void ShapeRenderedText::draw(RenderSurface *surface, int x, int y, bool /*destma
Std::list<PositionedText>::iterator iter;
- for (iter = lines.begin(); iter != lines.end(); ++iter) {
+ for (iter = _lines.begin(); iter != _lines.end(); ++iter) {
int line_x = x + iter->_dims.x;
int line_y = y + iter->_dims.y;
size_t textsize = iter->_text.size();
for (size_t i = 0; i < textsize; ++i) {
- surface->Paint(font, static_cast<unsigned char>(iter->_text[i]),
+ surface->Paint(_font, static_cast<unsigned char>(iter->_text[i]),
line_x, line_y);
if (i == iter->_cursor) {
- surface->Fill32(0xFF000000, line_x, line_y - font->getBaseline(),
+ surface->Fill32(0xFF000000, line_x, line_y - _font->getBaseline(),
1, iter->_dims.h);
}
- line_x += font->getWidth(iter->_text[i]) - font->getHlead();
+ line_x += _font->getWidth(iter->_text[i]) - _font->getHlead();
}
if (iter->_cursor == textsize) {
- surface->Fill32(0xFF000000, line_x, line_y - font->getBaseline(),
+ surface->Fill32(0xFF000000, line_x, line_y - _font->getBaseline(),
1, iter->_dims.h);
}
}
@@ -81,17 +80,17 @@ void ShapeRenderedText::drawBlended(RenderSurface *surface, int x, int y,
Std::list<PositionedText>::iterator iter;
- for (iter = lines.begin(); iter != lines.end(); ++iter) {
+ for (iter = _lines.begin(); iter != _lines.end(); ++iter) {
int line_x = x + iter->_dims.x;
int line_y = y + iter->_dims.y;
size_t textsize = iter->_text.size();
for (size_t i = 0; i < textsize; ++i) {
- surface->PaintHighlight(font,
+ surface->PaintHighlight(_font,
static_cast<unsigned char>(iter->_text[i]),
line_x, line_y, false, false, col);
- line_x += font->getWidth(iter->_text[i]) - font->getHlead();
+ line_x += _font->getWidth(iter->_text[i]) - _font->getHlead();
}
}
diff --git a/engines/ultima/ultima8/graphics/fonts/shape_rendered_text.h b/engines/ultima/ultima8/graphics/fonts/shape_rendered_text.h
index cbaea2a..91bbd69 100644
--- a/engines/ultima/ultima8/graphics/fonts/shape_rendered_text.h
+++ b/engines/ultima/ultima8/graphics/fonts/shape_rendered_text.h
@@ -44,8 +44,8 @@ public:
ENABLE_RUNTIME_CLASSTYPE()
protected:
- Std::list<PositionedText> lines;
- ShapeFont *font;
+ Std::list<PositionedText> _lines;
+ ShapeFont *_font;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/graphics/fonts/tt_font.cpp b/engines/ultima/ultima8/graphics/fonts/tt_font.cpp
index 74ca429..b1ded4b 100644
--- a/engines/ultima/ultima8/graphics/fonts/tt_font.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/tt_font.cpp
@@ -45,11 +45,11 @@ static const uint16 BULLETS[] = { 0x2022, 0x30FB, 0x25CF, 0 };
TTFont::TTFont(Graphics::Font *font, uint32 rgb_, int bordersize_,
bool antiAliased_, bool SJIS_)
- : ttf_font(font), antiAliased(antiAliased_), SJIS(SJIS_) {
-// rgb = PACK_RGB8( (rgb_>>16)&0xFF , (rgb_>>8)&0xFF , rgb_&0xFF );
+ : _ttfFont(font), _antiAliased(antiAliased_), _SJIS(SJIS_) {
+// _rgb = PACK_RGB8( (rgb_>>16)&0xFF , (rgb_>>8)&0xFF , rgb_&0xFF );
// This should be performed by PACK_RGB8, but it is not initialized at this point.
- rgb = ((rgb_ >> 16) & 0xFF) | (((rgb_ >> 8) & 0xFF) << 8) | ((rgb_ & 0xFF) << 16);
- bordersize = bordersize_;
+ _rgb = ((rgb_ >> 16) & 0xFF) | (((rgb_ >> 8) & 0xFF) << 8) | ((rgb_ & 0xFF) << 16);
+ _borderSize = bordersize_;
bullet = 0;
// scan for a character to use as a conversation option bullet
@@ -72,17 +72,17 @@ TTFont::~TTFont() {
}
int TTFont::getHeight() {
- return ttf_font->getFontHeight() + 2 * bordersize; // constant (border)
+ return _ttfFont->getFontHeight() + 2 * _borderSize; // constant (border)
}
int TTFont::getBaseline() {
-// return TTF_FontAscent(ttf_font);
+// return TTF_FontAscent(_ttfFont);
// TODO: TTF ascent isn't publically accessible
return 0;
}
int TTFont::getBaselineSkip() {
-// return TTF_FontLineSkip(ttf_font);
+// return TTF_FontLineSkip(_ttfFont);
// TODO: What should be returned for this?
return 0;
}
@@ -117,16 +117,16 @@ static Common::U32String toUnicode(const Std::string &text, uint16 bullet) {
void TTFont::getStringSize(const Std::string &text, int32 &width, int32 &height) {
// convert to unicode
Common::U32String unicodeText;
- if (!SJIS)
+ if (!_SJIS)
unicodeText = toUnicode<Traits>(text, bullet);
else
unicodeText = toUnicode<SJISTraits>(text, bullet);
- width = ttf_font->getStringWidth(unicodeText);
- height = ttf_font->getFontHeight();
+ width = _ttfFont->getStringWidth(unicodeText);
+ height = _ttfFont->getFontHeight();
- width += 2 * bordersize;
- height += 2 * bordersize;
+ width += 2 * _borderSize;
+ height += 2 * _borderSize;
}
void TTFont::getTextSize(const Std::string &text,
@@ -135,7 +135,7 @@ void TTFont::getTextSize(const Std::string &text,
int32 width, int32 height, TextAlign align,
bool u8specials) {
Std::list<PositionedText> tmp;
- if (!SJIS)
+ if (!_SJIS)
tmp = typesetText<Traits>(this, text, remaining,
width, height, align, u8specials,
resultwidth, resultheight);
@@ -153,7 +153,7 @@ RenderedText *TTFont::renderText(const Std::string &text,
Std::string::size_type cursor) {
int32 resultwidth, resultheight;
Std::list<PositionedText> lines;
- if (!SJIS)
+ if (!_SJIS)
lines = typesetText<Traits>(this, text, remaining,
width, height, align, u8specials,
resultwidth, resultheight, cursor);
@@ -179,7 +179,7 @@ RenderedText *TTFont::renderText(const Std::string &text,
for (iter = lines.begin(); iter != lines.end(); ++iter) {
// convert to unicode
Common::U32String unicodeText;
- if (!SJIS)
+ if (!_SJIS)
unicodeText = toUnicode<Traits>(iter->_text, bullet);
else
unicodeText = toUnicode<SJISTraits>(iter->_text, bullet);
@@ -187,18 +187,18 @@ RenderedText *TTFont::renderText(const Std::string &text,
// Create a surface and render the text
Graphics::ManagedSurface textSurf;
- if (!antiAliased) {
+ if (!_antiAliased) {
// When not in antialiased mode, use a paletted surface where '1' is
// used for pixels of the text
textSurf.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
- ttf_font->drawString(&textSurf, unicodeText, 0, 0, width, 1);
+ _ttfFont->drawString(&textSurf, unicodeText, 0, 0, width, 1);
} else {
- // Use a high color surface with the specified rgb color for text
+ // Use a high color surface with the specified _rgb color for text
textSurf.create(width, height,
Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
- uint32 color = textSurf.format.RGBToColor(TEX32_R(rgb), TEX32_G(rgb), TEX32_B(rgb));
+ uint32 color = textSurf.format.RGBToColor(TEX32_R(_rgb), TEX32_G(_rgb), TEX32_B(_rgb));
- ttf_font->drawString(&textSurf, unicodeText, 0, 0, width, color);
+ _ttfFont->drawString(&textSurf, unicodeText, 0, 0, width, color);
};
#if 0
@@ -211,14 +211,14 @@ RenderedText *TTFont::renderText(const Std::string &text,
for (int y = 0; y < textSurf.h; y++) {
byte *surfrow = (byte *)textSurf.getBasePtr(0, y);
- // CHECKME: bordersize!
- uint32 *bufrow = buf + (iter->_dims.y + y + bordersize) * resultwidth;
+ // CHECKME: _borderSize!
+ uint32 *bufrow = buf + (iter->_dims.y + y + _borderSize) * resultwidth;
for (int x = 0; x < textSurf.w; x++) {
- if (!antiAliased && surfrow[x] == 1) {
- bufrow[iter->_dims.x + x + bordersize] = rgb | 0xFF000000;
- if (bordersize <= 0) continue;
- if (bordersize == 1) {
+ if (!_antiAliased && surfrow[x] == 1) {
+ bufrow[iter->_dims.x + x + _borderSize] = _rgb | 0xFF000000;
+ if (_borderSize <= 0) continue;
+ if (_borderSize == 1) {
// optimize common case
for (int dx = -1; dx <= 1; dx++) {
for (int dy = -1; dy <= 1; dy++) {
@@ -233,18 +233,18 @@ RenderedText *TTFont::renderText(const Std::string &text,
}
continue;
}
- for (int dx = -bordersize; dx <= bordersize; dx++) {
- for (int dy = -bordersize; dy <= bordersize; dy++) {
- if (x + bordersize + iter->_dims.x + dx >= 0 &&
- x + bordersize + iter->_dims.x + dx < resultwidth &&
- y + bordersize + dy >= 0 && y + bordersize + dy < resultheight) {
- if (buf[(y + iter->_dims.y + dy + bordersize)*resultwidth + x + bordersize + iter->_dims.x + dx] == 0) {
- buf[(y + iter->_dims.y + dy + bordersize)*resultwidth + x + bordersize + iter->_dims.x + dx] = 0xFF000000;
+ for (int dx = -_borderSize; dx <= _borderSize; dx++) {
+ for (int dy = -_borderSize; dy <= _borderSize; dy++) {
+ if (x + _borderSize + iter->_dims.x + dx >= 0 &&
+ x + _borderSize + iter->_dims.x + dx < resultwidth &&
+ y + _borderSize + dy >= 0 && y + _borderSize + dy < resultheight) {
+ if (buf[(y + iter->_dims.y + dy + _borderSize)*resultwidth + x + _borderSize + iter->_dims.x + dx] == 0) {
+ buf[(y + iter->_dims.y + dy + _borderSize)*resultwidth + x + _borderSize + iter->_dims.x + dx] = 0xFF000000;
}
}
}
}
- } else if (antiAliased) {
+ } else if (_antiAliased) {
uint32 pixColor = *((uint32 *)(surfrow + x * 4));
if (pixColor == 0)
continue;
@@ -253,13 +253,13 @@ RenderedText *TTFont::renderText(const Std::string &text,
textSurf.format.colorToARGB(pixColor, pixA, pixR, pixG, pixB);
int idx = pixA;
- if (bordersize <= 0) {
- bufrow[iter->_dims.x + x + bordersize] = TEX32_PACK_RGBA(pixR, pixG, pixB, pixA);
+ if (_borderSize <= 0) {
+ bufrow[iter->_dims.x + x + _borderSize] = TEX32_PACK_RGBA(pixR, pixG, pixB, pixA);
} else {
- bufrow[iter->_dims.x + x + bordersize] = TEX32_PACK_RGBA(pixR, pixG, pixB, 0xFF);
+ bufrow[iter->_dims.x + x + _borderSize] = TEX32_PACK_RGBA(pixR, pixG, pixB, 0xFF);
// optimize common case
- if (bordersize == 1) for (int dx = -1; dx <= 1; dx++) {
+ if (_borderSize == 1) for (int dx = -1; dx <= 1; dx++) {
for (int dy = -1; dy <= 1; dy++) {
if (x + 1 + iter->_dims.x + dx >= 0 &&
x + 1 + iter->_dims.x + dx < resultwidth &&
@@ -272,15 +272,15 @@ RenderedText *TTFont::renderText(const Std::string &text,
}
}
} else {
- for (int dx = -bordersize; dx <= bordersize; dx++) {
- for (int dy = -bordersize; dy <= bordersize; dy++) {
- if (x + bordersize + iter->_dims.x + dx >= 0 &&
- x + bordersize + iter->_dims.x + dx < resultwidth &&
- y + bordersize + dy >= 0 && y + bordersize + dy < resultheight) {
- uint32 alpha = TEX32_A(buf[(y + iter->_dims.y + dy + bordersize) * resultwidth + x + bordersize + iter->_dims.x + dx]);
+ for (int dx = -_borderSize; dx <= _borderSize; dx++) {
+ for (int dy = -_borderSize; dy <= _borderSize; dy++) {
+ if (x + _borderSize + iter->_dims.x + dx >= 0 &&
+ x + _borderSize + iter->_dims.x + dx < resultwidth &&
+ y + _borderSize + dy >= 0 && y + _borderSize + dy < resultheight) {
+ uint32 alpha = TEX32_A(buf[(y + iter->_dims.y + dy + _borderSize) * resultwidth + x + _borderSize + iter->_dims.x + dx]);
if (alpha != 0xFF) {
alpha = 255 - (((255 - alpha) * (255 - idx)) >> 8);
- buf[(y + iter->_dims.y + dy + bordersize)*resultwidth + x + bordersize + iter->_dims.x + dx] = alpha << TEX32_A_SHIFT;
+ buf[(y + iter->_dims.y + dy + _borderSize)*resultwidth + x + _borderSize + iter->_dims.x + dx] = alpha << TEX32_A_SHIFT;
}
}
}
@@ -295,13 +295,13 @@ RenderedText *TTFont::renderText(const Std::string &text,
assert(iter->_cursor <= iter->_text.size());
unicodeText = Common::U32String(unicodeText.c_str(), iter->_cursor);
- int w = ttf_font->getStringWidth(unicodeText);
+ int w = _ttfFont->getStringWidth(unicodeText);
for (int y = 0; y < iter->_dims.h; y++) {
uint32 *bufrow = buf + (iter->_dims.y + y) * resultwidth;
- bufrow[iter->_dims.x + w + bordersize] = 0xFF000000;
-// if (bordersize > 0)
-// bufrow[iter->_dims.x+w+bordersize-1] = 0xFF000000;
+ bufrow[iter->_dims.x + w + _borderSize] = 0xFF000000;
+// if (_borderSize > 0)
+// bufrow[iter->_dims.x+w+_borderSize-1] = 0xFF000000;
}
}
}
diff --git a/engines/ultima/ultima8/graphics/fonts/tt_font.h b/engines/ultima/ultima8/graphics/fonts/tt_font.h
index bcbe01d..609b0fd 100644
--- a/engines/ultima/ultima8/graphics/fonts/tt_font.h
+++ b/engines/ultima/ultima8/graphics/fonts/tt_font.h
@@ -41,7 +41,7 @@ public:
int getBaselineSkip() override;
bool isAntialiased() {
- return antiAliased;
+ return _antiAliased;
}
void getStringSize(const Std::string &text,
@@ -59,11 +59,11 @@ public:
ENABLE_RUNTIME_CLASSTYPE()
protected:
- Graphics::Font *ttf_font;
- uint32 rgb;
- int bordersize;
- bool antiAliased;
- bool SJIS;
+ Graphics::Font *_ttfFont;
+ uint32 _rgb;
+ int _borderSize;
+ bool _antiAliased;
+ bool _SJIS;
uint16 bullet;
};
diff --git a/engines/ultima/ultima8/graphics/fonts/ttf_rendered_text.cpp b/engines/ultima/ultima8/graphics/fonts/ttf_rendered_text.cpp
index 8ebc39d..86421fe 100644
--- a/engines/ultima/ultima8/graphics/fonts/ttf_rendered_text.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/ttf_rendered_text.cpp
@@ -21,7 +21,6 @@
*/
#include "ultima/ultima8/misc/pent_include.h"
-
#include "ultima/ultima8/graphics/fonts/ttf_rendered_text.h"
#include "ultima/ultima8/graphics/fonts/tt_font.h"
#include "ultima/ultima8/graphics/render_surface.h"
@@ -33,39 +32,38 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(TTFRenderedText, RenderedText)
-TTFRenderedText::TTFRenderedText(Texture *texture_, int width_, int height_,
- int vlead_, TTFont *font_)
- : texture(texture_), font(font_) {
- width = width_;
- height = height_;
- vlead = vlead_;
+TTFRenderedText::TTFRenderedText(Texture *texture_, int width, int height,
+ int vLead, TTFont *font) : _texture(texture_), _font(font) {
+ _width = width;
+ _height = height;
+ _vLead = vLead;
}
TTFRenderedText::~TTFRenderedText() {
- delete texture;
+ delete _texture;
}
void TTFRenderedText::draw(RenderSurface *surface, int x, int y,
bool destmasked) {
if (!destmasked)
- surface->Blit(texture, 0, 0, width, height, x, y - font->getBaseline(),
- font->isAntialiased());
+ surface->Blit(_texture, 0, 0, _width, _height, x, y - _font->getBaseline(),
+ _font->isAntialiased());
else
- surface->MaskedBlit(texture, 0, 0, width, height,
- x, y - font->getBaseline(),
- 0, font->isAntialiased());
+ surface->MaskedBlit(_texture, 0, 0, _width, _height,
+ x, y - _font->getBaseline(),
+ 0, _font->isAntialiased());
}
void TTFRenderedText::drawBlended(RenderSurface *surface, int x, int y,
uint32 col, bool destmasked) {
if (!destmasked)
- surface->FadedBlit(texture, 0, 0, width, height,
- x, y - font->getBaseline(), col,
- font->isAntialiased());
+ surface->FadedBlit(_texture, 0, 0, _width, _height,
+ x, y - _font->getBaseline(), col,
+ _font->isAntialiased());
else
- surface->MaskedBlit(texture, 0, 0, width, height,
- x, y - font->getBaseline(), col,
- font->isAntialiased());
+ surface->MaskedBlit(_texture, 0, 0, _width, _height,
+ x, y - _font->getBaseline(), col,
+ _font->isAntialiased());
}
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/graphics/fonts/ttf_rendered_text.h b/engines/ultima/ultima8/graphics/fonts/ttf_rendered_text.h
index 3609c8e..2fa7140 100644
--- a/engines/ultima/ultima8/graphics/fonts/ttf_rendered_text.h
+++ b/engines/ultima/ultima8/graphics/fonts/ttf_rendered_text.h
@@ -47,8 +47,8 @@ public:
ENABLE_RUNTIME_CLASSTYPE()
protected:
- Texture *texture;
- TTFont *font;
+ Texture *_texture;
+ TTFont *_font;
};
} // End of namespace Ultima8
More information about the Scummvm-git-logs
mailing list